@termuijs/widgets 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/base/Widget.ts","../src/display/Box.ts","../src/display/Text.ts","../src/display/LogView.ts","../src/display/Tree.ts","../src/display/JSONView.ts","../src/display/DiffView.ts","../src/display/StreamingText.ts","../src/display/ChatMessage.ts","../src/display/ToolCall.ts","../src/input/virtual-scroll.ts","../src/input/List.ts","../src/input/TextInput.ts","../src/input/VirtualList.ts","../src/input/CommandPalette.ts","../src/data/Table.ts","../src/data/Gauge.ts","../src/data/Sparkline.ts","../src/data/StatusIndicator.ts","../src/data/BarChart.ts","../src/layout/Grid.ts","../src/layout/ScrollView.ts","../src/layout/Center.ts","../src/layout/Card.ts","../src/layout/Columns.ts","../src/feedback/ProgressBar.ts","../src/feedback/MultiProgress.ts","../src/feedback/Spinner.ts","../src/feedback/Scrollbar.ts","../src/feedback/Skeleton.ts","../src/feedback/StatusMessage.ts","../src/feedback/Banner.ts","../src/data/KeyValue.ts","../src/data/Sidebar.ts","../src/data/LineChart.ts","../src/data/HeatMap.ts","../src/data/Definition.ts","../src/display/BigText.ts","../src/display/Gradient.ts"],"sourcesContent":["// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Public API\n// ─────────────────────────────────────────────────────\n\n// ── Base ──────────────────────────────────────────────\nexport { Widget } from './base/Widget.js';\nexport type { WidgetEvents } from './base/Widget.js';\n\n// ── Display Widgets ───────────────────────────────────\nexport { Box } from './display/Box.js';\nexport { Text } from './display/Text.js';\nexport type { TextProps } from './display/Text.js';\nexport { LogView } from './display/LogView.js';\nexport type { LogViewOptions } from './display/LogView.js';\nexport { Tree } from './display/Tree.js';\nexport type { TreeNode, TreeOptions } from './display/Tree.js';\nexport { JSONView, jsonToTree } from './display/JSONView.js';\nexport type { JSONViewOptions, JSONNodeData, JSONNodeType } from './display/JSONView.js';\nexport { DiffView } from './display/DiffView.js';\nexport type { DiffLine, DiffViewOptions } from './display/DiffView.js';\nexport { StreamingText } from './display/StreamingText.js';\nexport type { StreamingTextOptions } from './display/StreamingText.js';\nexport { ChatMessage } from './display/ChatMessage.js';\nexport type { ChatMessageOptions, MessageRole } from './display/ChatMessage.js';\nexport { ToolCall, ToolApproval } from './display/ToolCall.js';\nexport type { ToolCallOptions, ToolApprovalOptions, ToolCallStatus } from './display/ToolCall.js';\n\n// ── Virtual Scroll Helpers ────────────────────────────\nexport { computeRange, computeVariableRange } from './input/virtual-scroll.js';\nexport type { ScrollRange } from './input/virtual-scroll.js';\n\n// ── Input Widgets ─────────────────────────────────────\nexport { List } from './input/List.js';\nexport type { ListItem } from './input/List.js';\nexport { TextInput } from './input/TextInput.js';\nexport { VirtualList } from './input/VirtualList.js';\nexport type { VirtualListOptions } from './input/VirtualList.js';\nexport { CommandPalette } from './input/CommandPalette.js';\nexport type { Command, CommandPaletteOptions } from './input/CommandPalette.js';\n\n// ── Data Widgets ──────────────────────────────────────\nexport { Table } from './data/Table.js';\nexport type { TableColumn, TableRow, TableOptions } from './data/Table.js';\nexport { Gauge } from './data/Gauge.js';\nexport type { GaugeOptions } from './data/Gauge.js';\nexport { Sparkline } from './data/Sparkline.js';\nexport type { SparklineOptions } from './data/Sparkline.js';\nexport { StatusIndicator } from './data/StatusIndicator.js';\nexport type { StatusIndicatorOptions } from './data/StatusIndicator.js';\nexport { BarChart } from './data/BarChart.js';\nexport type { Bar, BarGroup, BarChartDirection, BarChartOptions } from './data/BarChart.js';\n\n// ── Layout Widgets ────────────────────────────────────\nexport { Grid } from './layout/Grid.js';\nexport type { GridOptions } from './layout/Grid.js';\nexport { ScrollView } from './layout/ScrollView.js';\nexport type { ScrollViewOptions } from './layout/ScrollView.js';\nexport { Center } from './layout/Center.js';\nexport type { CenterOptions } from './layout/Center.js';\nexport { Card } from './layout/Card.js';\nexport type { CardOptions } from './layout/Card.js';\nexport { Columns } from './layout/Columns.js';\nexport type { ColumnsOptions } from './layout/Columns.js';\n\n// ── Feedback Widgets ──────────────────────────────────\nexport { ProgressBar } from './feedback/ProgressBar.js';\nexport type { ProgressBarOptions } from './feedback/ProgressBar.js';\nexport { MultiProgress } from './feedback/MultiProgress.js';\nexport type { ProgressItem, MultiProgressOptions } from './feedback/MultiProgress.js';\nexport { Spinner, SPINNER_FRAMES } from './feedback/Spinner.js';\nexport type { SpinnerOptions } from './feedback/Spinner.js';\nexport { Scrollbar } from './feedback/Scrollbar.js';\nexport type { ScrollbarOrientation, ScrollbarOptions } from './feedback/Scrollbar.js';\nexport { Skeleton } from './feedback/Skeleton.js';\nexport type { SkeletonOptions } from './feedback/Skeleton.js';\nexport { StatusMessage } from './feedback/StatusMessage.js';\nexport type { StatusMessageOptions, StatusVariant } from './feedback/StatusMessage.js';\nexport { Banner } from './feedback/Banner.js';\nexport type { BannerOptions } from './feedback/Banner.js';\n\n// ── New Data Widgets ──────────────────────────────────\nexport { KeyValue } from './data/KeyValue.js';\nexport type { KeyValuePair, KeyValueOptions } from './data/KeyValue.js';\nexport { Sidebar } from './data/Sidebar.js';\nexport type { SidebarItem, SidebarOptions } from './data/Sidebar.js';\nexport { LineChart } from './data/LineChart.js';\nexport type { LineChartOptions } from './data/LineChart.js';\nexport { HeatMap } from './data/HeatMap.js';\nexport type { HeatMapOptions } from './data/HeatMap.js';\nexport { Definition } from './data/Definition.js';\nexport type { DefinitionPair, DefinitionOptions } from './data/Definition.js';\n\n// ── New Display Widgets ───────────────────────────────\nexport { BigText } from './display/BigText.js';\nexport type { BigTextOptions } from './display/BigText.js';\nexport { Gradient } from './display/Gradient.js';\nexport type { GradientOptions } from './display/Gradient.js';\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Base Widget class\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type LayoutNode,\n type Rect,\n type KeyEvent,\n type MouseEvent as TermMouseEvent,\n defaultStyle,\n mergeStyles,\n createLayoutNode,\n EventEmitter,\n normalizeEdges,\n getBorderChars,\n styleToCellAttrs,\n containsPoint,\n} from '@termuijs/core';\n\n/**\n * Event map for widgets.\n */\nexport interface WidgetEvents {\n key: KeyEvent;\n mouse: TermMouseEvent;\n focus: void;\n blur: void;\n mount: void;\n unmount: void;\n}\n\nlet _widgetIdCounter = 0;\n\n/** Reset the widget ID counter (for testing only). */\nexport function _resetWidgetIdCounter(): void {\n _widgetIdCounter = 0;\n}\n\n/**\n * Base class for all TermUI widgets.\n *\n * Provides:\n * - Unique ID generation\n * - Style management and merging\n * - Layout node generation with rect sync\n * - Border/padding rendering into the screen buffer\n * - Child management\n * - Focus support\n * - Event emission\n */\nexport abstract class Widget {\n /** Unique widget identifier */\n readonly id: string;\n\n /** Widget's style */\n protected _style: Style;\n\n /** Child widgets */\n protected _children: Widget[] = [];\n\n /** Parent widget (null for root) */\n parent: Widget | null = null;\n\n /** Computed layout rectangle */\n protected _rect: Rect = { x: 0, y: 0, width: 0, height: 0 };\n\n /** Reference to the layout node (set during getLayoutNode) */\n private _layoutNode: LayoutNode | null = null;\n\n /** Whether this widget can receive focus */\n focusable = false;\n\n /** Tab index for focus ordering */\n tabIndex = 0;\n\n /** Event emitter for this widget */\n readonly events = new EventEmitter<WidgetEvents>();\n\n /** Whether the widget is currently focused */\n isFocused = false;\n\n /**\n * Dirty flag — true when this widget needs re-rendering.\n * Newly created widgets start dirty.\n */\n protected _dirty = true;\n\n constructor(style: Partial<Style> = {}) {\n this.id = `widget_${++_widgetIdCounter}`;\n this._style = mergeStyles(defaultStyle(), style);\n }\n\n /** Get the current style */\n get style(): Style { return this._style; }\n\n /** Update the style (merge with existing) */\n setStyle(style: Partial<Style>): void {\n this._style = mergeStyles(this._style, style);\n this.markDirty();\n }\n\n /** Get the computed rect after layout */\n get rect(): Rect { return this._rect; }\n\n /** Add a child widget */\n addChild(child: Widget): void {\n child.parent = this;\n this._children.push(child);\n }\n\n /** Remove a child widget */\n removeChild(child: Widget): void {\n const idx = this._children.indexOf(child);\n if (idx >= 0) {\n this._children.splice(idx, 1);\n child.parent = null;\n }\n }\n\n /** Remove all children */\n clearChildren(): void {\n for (const child of this._children) {\n child.parent = null;\n }\n this._children = [];\n }\n\n /** Get all children */\n get children(): ReadonlyArray<Widget> { return this._children; }\n\n /**\n * Build the LayoutNode tree for this widget.\n * Stores a reference so we can sync computed rects back via syncLayout().\n */\n getLayoutNode(): LayoutNode {\n const childNodes = this._children\n .filter(c => c.style.visible !== false)\n .map(c => c.getLayoutNode());\n\n this._layoutNode = createLayoutNode(this.id, this._style, childNodes);\n return this._layoutNode;\n }\n\n /**\n * After computeLayout() has been called, sync the computed rects\n * from the layout tree back into widget `_rect` fields.\n * This MUST be called after computeLayout() and before render().\n */\n syncLayout(): void {\n if (this._layoutNode) {\n this._rect = { ...this._layoutNode.computed };\n }\n\n // Sync children (match visible children to layout node children)\n const visibleChildren = this._children.filter(c => c.style.visible !== false);\n for (let i = 0; i < visibleChildren.length; i++) {\n visibleChildren[i].syncLayout();\n }\n }\n\n /**\n * Render this widget (and children) into the screen buffer.\n * Automatically pushes a clip region if overflow is hidden (default).\n */\n render(screen: Screen): void {\n if (this._style.visible === false) return;\n\n // Push clip region if overflow is hidden (default style)\n const shouldClip = this._style.overflow !== 'visible';\n if (shouldClip) {\n screen.pushClip(this._rect);\n }\n\n // Render own content\n this._renderSelf(screen);\n\n // Render border\n this._renderBorder(screen);\n\n // Render children\n for (const child of this._children) {\n child.render(screen);\n }\n\n // Pop clip region\n if (shouldClip) {\n screen.popClip();\n }\n }\n\n /**\n * Override this to render the widget's own content.\n * The rect is available as `this._rect`.\n */\n protected abstract _renderSelf(screen: Screen): void;\n\n /**\n * Update the computed rect from layout results.\n */\n updateRect(rect: Rect): void {\n this._rect = rect;\n }\n\n /**\n * Mark this widget as needing re-render.\n * Propagates up to parent so the render loop can detect changes.\n */\n markDirty(): void {\n if (this._dirty) return; // Already dirty\n this._dirty = true;\n this.parent?.markDirty();\n }\n\n /**\n * Clear the dirty flag after rendering.\n */\n clearDirty(): void {\n this._dirty = false;\n for (const child of this._children) {\n child.clearDirty();\n }\n }\n\n /** Check if this widget (or any child) needs re-rendering */\n get isDirty(): boolean { return this._dirty; }\n\n /**\n * Render the border around this widget, including focus ring if focused.\n */\n protected _renderBorder(screen: Screen): void {\n const border = this._style.border;\n const hasBorder = border && border !== 'none';\n const showFocusRing = this.isFocused && this.focusable\n && this._style.focusRingStyle !== 'none';\n\n if (!hasBorder && !showFocusRing) return;\n\n const { x, y, width, height } = this._rect;\n if (width < 2 || height < 2) return;\n\n if (hasBorder) {\n const chars = getBorderChars(border);\n if (!chars) return;\n\n const attrs = styleToCellAttrs(this._style);\n const borderFg = this._style.borderColor ?? attrs.fg;\n\n // Use focus ring color when focused, otherwise normal border color\n const fg = showFocusRing\n ? (this._style.focusRingColor ?? { type: 'named' as const, name: 'cyan' as const })\n : borderFg;\n const cellStyle = { fg };\n\n // Top edge\n screen.setCell(x, y, { char: chars.topLeft, ...cellStyle });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y, { char: chars.top, ...cellStyle });\n }\n screen.setCell(x + width - 1, y, { char: chars.topRight, ...cellStyle });\n\n // Bottom edge\n screen.setCell(x, y + height - 1, { char: chars.bottomLeft, ...cellStyle });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y + height - 1, { char: chars.bottom, ...cellStyle });\n }\n screen.setCell(x + width - 1, y + height - 1, { char: chars.bottomRight, ...cellStyle });\n\n // Left and right edges\n for (let r = 1; r < height - 1; r++) {\n screen.setCell(x, y + r, { char: chars.left, ...cellStyle });\n screen.setCell(x + width - 1, y + r, { char: chars.right, ...cellStyle });\n }\n } else if (showFocusRing) {\n // No border — render corner bracket focus indicators\n const fg = this._style.focusRingColor ?? { type: 'named' as const, name: 'cyan' as const };\n const cellStyle = { fg, bold: true };\n\n // Top-left corner\n screen.setCell(x, y, { char: '┌', ...cellStyle });\n if (width > 2) screen.setCell(x + 1, y, { char: '─', ...cellStyle });\n\n // Top-right corner\n screen.setCell(x + width - 1, y, { char: '┐', ...cellStyle });\n if (width > 2) screen.setCell(x + width - 2, y, { char: '─', ...cellStyle });\n\n // Bottom-left corner\n screen.setCell(x, y + height - 1, { char: '└', ...cellStyle });\n if (width > 2) screen.setCell(x + 1, y + height - 1, { char: '─', ...cellStyle });\n\n // Bottom-right corner\n screen.setCell(x + width - 1, y + height - 1, { char: '┘', ...cellStyle });\n if (width > 2) screen.setCell(x + width - 2, y + height - 1, { char: '─', ...cellStyle });\n\n // Short vertical marks if tall enough\n if (height > 2) {\n screen.setCell(x, y + 1, { char: '│', ...cellStyle });\n screen.setCell(x + width - 1, y + 1, { char: '│', ...cellStyle });\n screen.setCell(x, y + height - 2, { char: '│', ...cellStyle });\n screen.setCell(x + width - 1, y + height - 2, { char: '│', ...cellStyle });\n }\n }\n }\n\n /**\n * Get the inner content area (after border + padding).\n */\n protected _getContentRect(): Rect {\n const padding = normalizeEdges(this._style.padding);\n const border = this._style.border && this._style.border !== 'none' ? 1 : 0;\n\n return {\n x: this._rect.x + padding.left + border,\n y: this._rect.y + padding.top + border,\n width: Math.max(0, this._rect.width - padding.left - padding.right - border * 2),\n height: Math.max(0, this._rect.height - padding.top - padding.bottom - border * 2),\n };\n }\n\n /**\n * Check if a point hits this widget.\n */\n hitTest(x: number, y: number): boolean {\n return containsPoint(this._rect, x, y);\n }\n\n /** Lifecycle: called when the widget is mounted */\n mount(): void {\n this.events.emit('mount', undefined as any);\n for (const child of this._children) {\n child.mount();\n }\n }\n\n /** Lifecycle: called when the widget is unmounted */\n unmount(): void {\n for (const child of this._children) {\n child.unmount();\n }\n this.events.emit('unmount', undefined as any);\n this.events.removeAll();\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Box widget\n// ─────────────────────────────────────────────────────\n\nimport type { Screen, Style } from '@termuijs/core';\nimport { styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * Box — the fundamental container widget, similar to a `<div>`.\n *\n * Supports:\n * - Flexbox layout (row/column)\n * - Border styles (single/double/round/heavy/dashed)\n * - Padding and margin\n * - Background color\n */\nexport class Box extends Widget {\n constructor(style: Partial<Style> = {}) {\n super(style);\n }\n\n protected _renderSelf(screen: Screen): void {\n const { bg } = styleToCellAttrs(this._style);\n if (bg.type === 'none') return;\n\n const { x, y, width, height } = this._rect;\n const border = this._style.border && this._style.border !== 'none' ? 1 : 0;\n\n // Fill background\n for (let r = border; r < height - border; r++) {\n for (let c = border; c < width - border; c++) {\n screen.setCell(x + c, y + r, { char: ' ', bg });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Text widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, wordWrap, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface TextProps {\n content: string;\n wrap?: boolean;\n align?: 'left' | 'center' | 'right';\n /** Vertical scroll offset (lines to skip from top). Default: 0. */\n scrollY?: number;\n /** Horizontal scroll offset (columns to skip from left). Default: 0. */\n scrollX?: number;\n}\n\n/**\n * Text — renders a string of text with word-wrapping, alignment, and scrolling.\n */\nexport class Text extends Widget {\n private _content: string;\n private _wrap: boolean;\n private _align: 'left' | 'center' | 'right';\n private _scrollY: number;\n private _scrollX: number;\n\n constructor(content: string, style: Partial<Style> = {}, props: Partial<TextProps> = {}) {\n super(style);\n this._content = content;\n this._wrap = props.wrap ?? true;\n this._align = props.align ?? 'left';\n this._scrollY = props.scrollY ?? 0;\n this._scrollX = props.scrollX ?? 0;\n }\n\n /** Update the text content */\n setContent(content: string): void {\n this._content = content;\n this.markDirty();\n }\n\n /** Get current text content */\n getContent(): string {\n return this._content;\n }\n\n /** Set vertical scroll offset (lines to skip). */\n setScrollY(offset: number): void {\n this._scrollY = Math.max(0, offset);\n this.markDirty();\n }\n\n /** Set horizontal scroll offset (columns to skip). */\n setScrollX(offset: number): void {\n this._scrollX = Math.max(0, offset);\n this.markDirty();\n }\n\n /** Get the total number of lines after wrapping. */\n getLineCount(): number {\n const contentRect = this._getContentRect();\n const text = this._wrap ? wordWrap(this._content, contentRect.width) : this._content;\n return text.split('\\n').length;\n }\n\n protected _renderSelf(screen: Screen): void {\n const contentRect = this._getContentRect();\n const { x, y, width, height } = contentRect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Word-wrap if enabled\n let text = this._wrap ? wordWrap(this._content, width) : this._content;\n const allLines = text.split('\\n');\n\n // Apply vertical scroll\n const startLine = Math.min(this._scrollY, allLines.length);\n const visibleLines = allLines.slice(startLine, startLine + height);\n\n for (let i = 0; i < Math.min(visibleLines.length, height); i++) {\n let line = visibleLines[i];\n if (line === undefined) continue;\n\n // Apply horizontal scroll\n if (this._scrollX > 0) {\n // Skip scrollX characters\n let skipped = 0;\n let charIndex = 0;\n for (const ch of line) {\n if (skipped >= this._scrollX) break;\n skipped++;\n charIndex += ch.length;\n }\n line = line.slice(charIndex);\n }\n\n const lineWidth = stringWidth(line);\n\n // Apply alignment\n let offsetX = 0;\n if (this._align === 'center') {\n offsetX = Math.floor((width - lineWidth) / 2);\n } else if (this._align === 'right') {\n offsetX = width - lineWidth;\n }\n\n screen.writeString(x + Math.max(0, offsetX), y + i, line, attrs);\n }\n }\n}\n\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — LogView widget (scrollable log)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface LogViewOptions {\n /** Highlight rules: keyword → color */\n highlight?: Record<string, Color>;\n /** Auto-scroll to bottom */\n autoScroll?: boolean;\n}\n\n/**\n * LogView — scrollable, highlighted log output.\n *\n * Supports keyword-based color highlighting (ERROR → red, WARN → yellow, etc.)\n */\nexport class LogView extends Widget {\n private _lines: string[] = [];\n private _scrollOffset = 0;\n private _highlight: Record<string, Color>;\n private _autoScroll: boolean;\n\n constructor(style: Partial<Style> = {}, opts: LogViewOptions = {}) {\n super(style);\n this._highlight = opts.highlight ?? {\n ERROR: { type: 'named', name: 'red' },\n WARN: { type: 'named', name: 'yellow' },\n INFO: { type: 'named', name: 'green' },\n DEBUG: { type: 'named', name: 'brightBlack' },\n };\n this._autoScroll = opts.autoScroll ?? true;\n }\n\n setLines(lines: string[]): void {\n this._lines = lines;\n if (this._autoScroll) {\n this._scrollToBottom();\n }\n this.markDirty();\n }\n\n appendLine(line: string): void {\n this._lines.push(line);\n if (this._autoScroll) {\n this._scrollToBottom();\n }\n this.markDirty();\n }\n\n scrollUp(n = 1): void {\n this._scrollOffset = Math.max(0, this._scrollOffset - n);\n }\n\n scrollDown(n = 1): void {\n this._scrollOffset = Math.min(\n Math.max(0, this._lines.length - 1),\n this._scrollOffset + n,\n );\n }\n\n private _scrollToBottom(): void {\n const rect = this._getContentRect();\n const visibleLines = Math.max(1, rect.height);\n this._scrollOffset = Math.max(0, this._lines.length - visibleLines);\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const visibleLines = this._lines.slice(this._scrollOffset, this._scrollOffset + height);\n\n for (let i = 0; i < Math.min(visibleLines.length, height); i++) {\n const line = truncate(visibleLines[i], width);\n const lineColor = this._getLineColor(line);\n\n screen.writeString(x, y + i, line, {\n ...attrs,\n ...(lineColor ? { fg: lineColor } : {}),\n });\n }\n }\n\n private _getLineColor(line: string): Color | null {\n for (const [keyword, color] of Object.entries(this._highlight)) {\n if (line.includes(keyword)) return color;\n }\n return null;\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Tree widget (collapsible hierarchy)\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n styleToCellAttrs,\n truncate,\n stringWidth,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface TreeNode {\n label: string;\n children?: TreeNode[];\n expanded?: boolean; // default: false\n data?: unknown; // user data attached to node\n}\n\nexport interface TreeOptions {\n nodes: TreeNode[];\n onSelect?: (node: TreeNode, path: number[]) => void;\n indent?: number; // spaces per level, default 2\n}\n\ninterface VisibleEntry {\n node: TreeNode;\n depth: number;\n path: number[];\n}\n\n/**\n * Tree — a collapsible tree widget for displaying hierarchical data.\n *\n * Supports:\n * - Expand/collapse of parent nodes\n * - Keyboard navigation (ArrowUp/Down/Left/Right, j/k/h/l, Home/End)\n * - Enter/Space to toggle or select\n * - onSelect callback for leaf nodes\n * - Unicode and ASCII fallback symbols\n * - Scrolling when tree exceeds visible height\n */\nexport class Tree extends Widget {\n private _nodes: TreeNode[];\n private _onSelect?: (node: TreeNode, path: number[]) => void;\n protected _indent: number;\n protected _selectedIndex = 0;\n protected _scrollOffset = 0;\n protected _visibleNodes: VisibleEntry[] = [];\n\n constructor(options: TreeOptions, style: Partial<Style> = {}) {\n super(style);\n this._nodes = options.nodes;\n this._onSelect = options.onSelect;\n this._indent = options.indent ?? 2;\n this.focusable = true;\n this._buildVisibleNodes();\n }\n\n // ── Public API ─────────────────────────────────────\n\n get selectedIndex(): number { return this._selectedIndex; }\n\n get selectedNode(): TreeNode | undefined {\n return this._visibleNodes[this._selectedIndex]?.node;\n }\n\n setNodes(nodes: TreeNode[]): void {\n this._nodes = nodes;\n this._selectedIndex = 0;\n this._scrollOffset = 0;\n this._buildVisibleNodes();\n this.markDirty();\n }\n\n /** Move cursor up one visible row */\n movePrev(): void {\n if (this._selectedIndex > 0) {\n this._selectedIndex--;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Move cursor down one visible row */\n moveNext(): void {\n if (this._selectedIndex < this._visibleNodes.length - 1) {\n this._selectedIndex++;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Go to first visible node */\n moveFirst(): void {\n this._selectedIndex = 0;\n this._clampScroll();\n this.markDirty();\n }\n\n /** Go to last visible node */\n moveLast(): void {\n if (this._visibleNodes.length > 0) {\n this._selectedIndex = this._visibleNodes.length - 1;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Expand the selected node (if it's a collapsed parent) */\n expand(): void {\n const entry = this._visibleNodes[this._selectedIndex];\n if (!entry) return;\n const node = entry.node;\n if (_isParent(node) && !node.expanded) {\n node.expanded = true;\n this._buildVisibleNodes();\n this.markDirty();\n }\n }\n\n /** Collapse the selected node, or move to parent if already collapsed/leaf */\n collapse(): void {\n const entry = this._visibleNodes[this._selectedIndex];\n if (!entry) return;\n const node = entry.node;\n\n if (_isParent(node) && node.expanded) {\n // Collapse current node\n node.expanded = false;\n this._buildVisibleNodes();\n this._clampScroll();\n this.markDirty();\n } else if (entry.depth > 0) {\n // Move to parent\n const parentPath = entry.path.slice(0, -1);\n const parentIdx = this._visibleNodes.findIndex(\n e => _pathsEqual(e.path, parentPath),\n );\n if (parentIdx >= 0) {\n this._selectedIndex = parentIdx;\n this._clampScroll();\n this.markDirty();\n }\n }\n }\n\n /** Toggle expand/collapse (parent) or call onSelect (leaf) */\n toggle(): void {\n const entry = this._visibleNodes[this._selectedIndex];\n if (!entry) return;\n const node = entry.node;\n\n if (_isParent(node)) {\n node.expanded = !node.expanded;\n this._buildVisibleNodes();\n this._clampScroll();\n this.markDirty();\n } else {\n // Leaf — call onSelect\n this._onSelect?.(node, entry.path);\n }\n }\n\n /**\n * Handle a key event. Call this from your app's key-routing logic\n * when this widget is focused.\n */\n handleKey(key: string): void {\n switch (key) {\n case 'ArrowUp':\n case 'k':\n this.movePrev();\n break;\n case 'ArrowDown':\n case 'j':\n this.moveNext();\n break;\n case 'Enter':\n case ' ':\n this.toggle();\n break;\n case 'ArrowLeft':\n case 'h':\n this.collapse();\n break;\n case 'ArrowRight':\n case 'l':\n this.expand();\n break;\n case 'Home':\n this.moveFirst();\n break;\n case 'End':\n this.moveLast();\n break;\n }\n }\n\n // ── Rendering ──────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const useUnicode = caps.unicode;\n\n const collapsedChevron = useUnicode ? '▶ ' : '> ';\n const expandedChevron = useUnicode ? '▼ ' : 'v ';\n const leafPrefix = useUnicode ? '• ' : '* ';\n\n const visibleCount = Math.min(\n this._visibleNodes.length - this._scrollOffset,\n height,\n );\n\n for (let i = 0; i < visibleCount; i++) {\n const entryIdx = this._scrollOffset + i;\n const entry = this._visibleNodes[entryIdx];\n const { node, depth } = entry;\n const isSelected = entryIdx === this._selectedIndex;\n\n // Build line text\n const indentStr = ' '.repeat(this._indent * depth);\n let chevron: string;\n if (_isParent(node)) {\n chevron = node.expanded ? expandedChevron : collapsedChevron;\n } else {\n chevron = leafPrefix;\n }\n let line = indentStr + chevron + node.label;\n line = truncate(line, width);\n\n // Cell style for selected row\n const cellStyle = isSelected && this.isFocused\n ? {\n ...attrs,\n bg: { type: 'named' as const, name: 'blue' as const },\n bold: true,\n }\n : isSelected\n ? { ...attrs, bold: true }\n : attrs;\n\n screen.writeString(x, y + i, line, cellStyle);\n\n // Fill rest of row for selection highlight\n if (isSelected && this.isFocused) {\n const lineWidth = stringWidth(line);\n const remaining = width - lineWidth;\n for (let c = 0; c < remaining; c++) {\n screen.setCell(x + lineWidth + c, y + i, {\n char: ' ',\n ...cellStyle,\n });\n }\n }\n }\n }\n\n // ── Private helpers ────────────────────────────────\n\n /** Rebuild the flat visible-node list from the tree */\n private _buildVisibleNodes(): void {\n this._visibleNodes = [];\n _collectVisible(this._nodes, 0, [], this._visibleNodes);\n }\n\n /** Ensure scroll keeps the selected index in view */\n private _clampScroll(): void {\n const rect = this._getContentRect();\n const visibleHeight = rect.height > 0 ? rect.height : 24; // fallback for zero-rect\n\n if (this._selectedIndex < this._scrollOffset) {\n this._scrollOffset = this._selectedIndex;\n }\n if (this._selectedIndex >= this._scrollOffset + visibleHeight) {\n this._scrollOffset = this._selectedIndex - visibleHeight + 1;\n }\n this._scrollOffset = Math.max(0, this._scrollOffset);\n }\n}\n\n// ── Module-level helpers ───────────────────────────────\n\nfunction _isParent(node: TreeNode): boolean {\n return Array.isArray(node.children) && node.children.length > 0;\n}\n\nfunction _pathsEqual(a: number[], b: number[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction _collectVisible(\n nodes: TreeNode[],\n depth: number,\n parentPath: number[],\n out: VisibleEntry[],\n): void {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n const path = [...parentPath, i];\n out.push({ node, depth, path });\n if (_isParent(node) && node.expanded) {\n _collectVisible(node.children!, depth + 1, path, out);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — JSONView widget (syntax-colored JSON tree)\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type Color,\n styleToCellAttrs,\n truncate,\n stringWidth,\n caps,\n} from '@termuijs/core';\nimport { Tree, type TreeNode } from './Tree.js';\n\n// ── Type metadata stored in node.data ─────────────────\n\nexport type JSONNodeType =\n | 'null'\n | 'boolean'\n | 'number'\n | 'string'\n | 'array'\n | 'object'\n | 'unknown';\n\nexport interface JSONNodeData {\n type: JSONNodeType;\n /** Original key (if any) that prefixes the label */\n key?: string;\n /** Raw primitive value (for non-container nodes) */\n value?: unknown;\n}\n\n// ── Options ───────────────────────────────────────────\n\nexport interface JSONViewOptions {\n /** The JSON value to display */\n data: unknown;\n /** Callback when a leaf node is selected */\n onSelect?: (node: TreeNode, path: number[]) => void;\n /** Spaces per indent level (default: 2) */\n indent?: number;\n}\n\n// ── jsonToTree() helper ────────────────────────────────\n\n/**\n * Convert any JSON-compatible value to a TreeNode, optionally prefixed\n * by `key` (the property name or array index in the parent container).\n */\nexport function jsonToTree(value: unknown, key?: string): TreeNode {\n const prefix = key !== undefined ? `${key}: ` : '';\n\n if (value === null) {\n return {\n label: `${prefix}null`,\n data: { type: 'null', key } satisfies JSONNodeData,\n };\n }\n\n if (typeof value === 'boolean') {\n return {\n label: `${prefix}${value}`,\n data: { type: 'boolean', key, value } satisfies JSONNodeData,\n };\n }\n\n if (typeof value === 'number') {\n return {\n label: `${prefix}${value}`,\n data: { type: 'number', key, value } satisfies JSONNodeData,\n };\n }\n\n if (typeof value === 'string') {\n return {\n label: `${prefix}\"${value}\"`,\n data: { type: 'string', key, value } satisfies JSONNodeData,\n };\n }\n\n if (Array.isArray(value)) {\n const children = value.map((v, i) => jsonToTree(v, String(i)));\n return {\n label: `${prefix}[${children.length}]`,\n children,\n expanded: false,\n data: { type: 'array', key } satisfies JSONNodeData,\n };\n }\n\n if (typeof value === 'object') {\n const obj = value as Record<string, unknown>;\n const children = Object.keys(obj).map(k => jsonToTree(obj[k], k));\n return {\n label: `${prefix}{${children.length}}`,\n children,\n expanded: false,\n data: { type: 'object', key } satisfies JSONNodeData,\n };\n }\n\n return {\n label: `${prefix}${String(value)}`,\n data: { type: 'unknown', key } satisfies JSONNodeData,\n };\n}\n\n// ── Color helpers ──────────────────────────────────────\n\n/** Pick the foreground color for the value part based on JSON type. */\nfunction _valueColor(type: JSONNodeType): Color {\n switch (type) {\n case 'string': return { type: 'named', name: 'green' };\n case 'number': return { type: 'named', name: 'yellow' };\n case 'boolean': return { type: 'named', name: 'magenta' };\n case 'null': return { type: 'named', name: 'magenta' };\n default: return { type: 'named', name: 'white' };\n }\n}\n\nconst KEY_COLOR: Color = { type: 'named', name: 'cyan' };\n\n/**\n * Split a label produced by jsonToTree into its key prefix and value parts.\n * e.g. `\"name: \\\"Alice\\\"\"` → `{ keyPart: \"name: \", valuePart: \"\\\"Alice\\\"\" }`\n * e.g. `\"null\"` → `{ keyPart: \"\", valuePart: \"null\" }`\n */\nfunction _splitLabel(label: string, nodeData: JSONNodeData): { keyPart: string; valuePart: string } {\n if (nodeData.key !== undefined) {\n const sep = `${nodeData.key}: `;\n if (label.startsWith(sep)) {\n return { keyPart: sep, valuePart: label.slice(sep.length) };\n }\n }\n return { keyPart: '', valuePart: label };\n}\n\n// ── JSONView ───────────────────────────────────────────\n\n/**\n * JSONView — a syntax-colored, collapsible JSON viewer.\n *\n * Extends `Tree` and overrides `_renderSelf` to colorize each row:\n * - Key portion (the `\"key: \"` prefix) is rendered in cyan\n * - Value portion is colored by JSON type:\n * - string → green\n * - number → yellow\n * - boolean / null → magenta\n * - object `{n}` / array `[n]` → white (default)\n *\n * Usage:\n * ```ts\n * const view = new JSONView({ data: { name: 'Alice', age: 30 } });\n * view.updateRect({ x: 0, y: 0, width: 60, height: 20 });\n * view.render(screen);\n * ```\n */\nexport class JSONView extends Tree {\n constructor(options: JSONViewOptions, style: Partial<Style> = {}) {\n const root = jsonToTree(options.data);\n // If the root is a container, use its children as top-level nodes;\n // otherwise wrap the single node in an array.\n const nodes = root.children && root.children.length > 0 ? root.children : [root];\n super({ nodes, onSelect: options.onSelect, indent: options.indent }, style);\n }\n\n // ── Override rendering ─────────────────────────────\n\n /**\n * Replicate Tree's _renderSelf but colorize key/value segments.\n * We access the private state via `(this as any)` since Tree doesn't\n * expose those fields publicly — the tradeoff of extending vs composing.\n */\n protected override _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const useUnicode = caps.unicode;\n\n const collapsedChevron = useUnicode ? '▶ ' : '> ';\n const expandedChevron = useUnicode ? '▼ ' : 'v ';\n const leafPrefix = useUnicode ? '• ' : '* ';\n\n // Access Tree's protected fields directly\n const visibleNodes = this._visibleNodes;\n const scrollOffset = this._scrollOffset;\n const selectedIndex = this._selectedIndex;\n const indent = this._indent;\n\n const visibleCount = Math.min(\n visibleNodes.length - scrollOffset,\n height,\n );\n\n for (let i = 0; i < visibleCount; i++) {\n const entryIdx = scrollOffset + i;\n const entry = visibleNodes[entryIdx];\n const { node, depth } = entry;\n const isSelected = entryIdx === selectedIndex;\n const nodeData = (node.data ?? { type: 'unknown' }) as JSONNodeData;\n\n // Build the prefix (indent + chevron/bullet)\n const indentStr = ' '.repeat(indent * depth);\n const isParent = Array.isArray(node.children) && node.children.length > 0;\n let chevron: string;\n if (isParent) {\n chevron = node.expanded ? expandedChevron : collapsedChevron;\n } else {\n chevron = leafPrefix;\n }\n const linePrefix = indentStr + chevron;\n\n // Split label into key part and value part for colorization\n const { keyPart, valuePart } = _splitLabel(node.label, nodeData);\n\n // Base cell attrs (selection highlight)\n const baseCellStyle = isSelected && this.isFocused\n ? {\n ...attrs,\n bg: { type: 'named' as const, name: 'blue' as const },\n bold: true,\n }\n : isSelected\n ? { ...attrs, bold: true }\n : attrs;\n\n // Write the prefix (indent + chevron) in base style\n let cursorX = x;\n const prefixTrunc = truncate(linePrefix, width);\n if (prefixTrunc.length > 0) {\n screen.writeString(cursorX, y + i, prefixTrunc, baseCellStyle);\n cursorX += stringWidth(prefixTrunc);\n }\n\n const remaining = width - (cursorX - x);\n if (remaining <= 0) {\n _fillSelection(screen, x, y + i, width, cursorX - x, isSelected, this.isFocused, baseCellStyle);\n continue;\n }\n\n // Write key part in cyan\n if (keyPart.length > 0) {\n const keyTrunc = truncate(keyPart, remaining);\n const keyStyle = { ...baseCellStyle, fg: KEY_COLOR };\n screen.writeString(cursorX, y + i, keyTrunc, keyStyle);\n cursorX += stringWidth(keyTrunc);\n }\n\n const remaining2 = width - (cursorX - x);\n if (remaining2 <= 0) {\n _fillSelection(screen, x, y + i, width, cursorX - x, isSelected, this.isFocused, baseCellStyle);\n continue;\n }\n\n // Write value part colored by JSON type\n if (valuePart.length > 0) {\n const valTrunc = truncate(valuePart, remaining2);\n const valColor = _valueColor(nodeData.type);\n const valStyle = { ...baseCellStyle, fg: valColor };\n screen.writeString(cursorX, y + i, valTrunc, valStyle);\n cursorX += stringWidth(valTrunc);\n }\n\n // Fill remainder of row for selection highlight background\n _fillSelection(screen, x, y + i, width, cursorX - x, isSelected, this.isFocused, baseCellStyle);\n }\n }\n}\n\n// ── Module-level render helpers ────────────────────────\n\n/** Fill trailing cells on a selected+focused row for solid highlight background. */\nfunction _fillSelection(\n screen: Screen,\n rowX: number,\n rowY: number,\n width: number,\n writtenWidth: number,\n isSelected: boolean,\n isFocused: boolean,\n cellStyle: Record<string, unknown>,\n): void {\n if (!isSelected || !isFocused) return;\n const remaining = width - writtenWidth;\n for (let c = 0; c < remaining; c++) {\n screen.setCell(rowX + writtenWidth + c, rowY, {\n char: ' ',\n ...cellStyle,\n });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — DiffView widget (unified diff viewer)\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n styleToCellAttrs,\n stringWidth,\n truncate,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface DiffLine {\n type: 'add' | 'remove' | 'context';\n content: string;\n lineNo?: number; // optional line number to show in gutter\n}\n\nexport interface DiffViewOptions {\n lines: DiffLine[];\n showLineNumbers?: boolean; // default: true\n gutterWidth?: number; // default: 5 (e.g. \" 123 \")\n}\n\n/**\n * DiffView — a scrollable unified diff viewer with +/- line coloring.\n *\n * Supports:\n * - Gutter with optional right-aligned line numbers (dim)\n * - '+' prefix for added lines (green fg)\n * - '-' prefix for removed lines (red fg)\n * - ' ' prefix for context lines (dim fg)\n * - Keyboard scrolling: ArrowUp/Down, j/k, PageUp/PageDown, Home/End\n */\nexport class DiffView extends Widget {\n private _lines: DiffLine[];\n private _scrollOffset = 0;\n private _showLineNumbers: boolean;\n private _gutterWidth: number;\n\n constructor(options: DiffViewOptions, style: Partial<Style> = {}) {\n super(style);\n this._lines = options.lines;\n this._showLineNumbers = options.showLineNumbers ?? true;\n this._gutterWidth = options.gutterWidth ?? 5;\n this.focusable = true;\n }\n\n setLines(lines: DiffLine[]): void {\n this._lines = lines;\n this._scrollOffset = 0;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const baseAttrs = styleToCellAttrs(this._style);\n const visibleLines = this._lines.slice(\n this._scrollOffset,\n this._scrollOffset + height,\n );\n\n for (let i = 0; i < visibleLines.length; i++) {\n const diffLine = visibleLines[i];\n let col = x;\n const row = y + i;\n\n // ── Determine color by type ────────────────────────\n const isAdd = diffLine.type === 'add';\n const isRemove = diffLine.type === 'remove';\n const isContext = diffLine.type === 'context';\n\n const fg = isAdd\n ? { type: 'named' as const, name: 'green' as const }\n : isRemove\n ? { type: 'named' as const, name: 'red' as const }\n : undefined;\n\n const lineAttrs = {\n ...baseAttrs,\n ...(fg ? { fg } : {}),\n dim: isContext,\n };\n\n // ── Gutter ─────────────────────────────────────────\n if (this._showLineNumbers) {\n const gutterStr =\n diffLine.lineNo !== undefined\n ? String(diffLine.lineNo).padStart(this._gutterWidth - 1, ' ') + ' '\n : ' '.repeat(this._gutterWidth);\n\n const gutterAttrs = { ...baseAttrs, dim: true };\n screen.writeString(col, row, gutterStr.slice(0, this._gutterWidth), gutterAttrs);\n col += this._gutterWidth;\n }\n\n // ── Prefix character ───────────────────────────────\n const prefix = isAdd ? '+' : isRemove ? '-' : ' ';\n const remainingWidth = width - (col - x);\n if (remainingWidth <= 0) continue;\n\n screen.writeString(col, row, prefix, lineAttrs);\n col += 1;\n\n // ── Content ────────────────────────────────────────\n const contentWidth = width - (col - x);\n if (contentWidth <= 0) continue;\n\n const content = truncate(diffLine.content, contentWidth);\n screen.writeString(col, row, content, lineAttrs);\n }\n }\n\n handleKey(key: string): void {\n const rect = this._getContentRect();\n const visibleHeight = Math.max(1, rect.height);\n const maxOffset = Math.max(0, this._lines.length - visibleHeight);\n\n switch (key) {\n case 'ArrowUp':\n case 'k':\n this._scrollOffset = Math.max(0, this._scrollOffset - 1);\n this.markDirty();\n break;\n\n case 'ArrowDown':\n case 'j':\n this._scrollOffset = Math.min(maxOffset, this._scrollOffset + 1);\n this.markDirty();\n break;\n\n case 'PageUp':\n this._scrollOffset = Math.max(0, this._scrollOffset - visibleHeight);\n this.markDirty();\n break;\n\n case 'PageDown':\n this._scrollOffset = Math.min(maxOffset, this._scrollOffset + visibleHeight);\n this.markDirty();\n break;\n\n case 'Home':\n this._scrollOffset = 0;\n this.markDirty();\n break;\n\n case 'End':\n this._scrollOffset = maxOffset;\n this.markDirty();\n break;\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — StreamingText widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, wordWrap, caps } from '@termuijs/core';\nimport { timerPoolSubscribe } from '@termuijs/motion';\nimport { Widget } from '../base/Widget.js';\n\nexport interface StreamingTextOptions {\n /** Full text content */\n text: string;\n /** Cursor character. Default: '▋' */\n cursor?: string;\n /** Characters to reveal per tick (0 = show all immediately). Default: 0 */\n speed?: number;\n /** Cursor blink interval in ms. Default: 530 */\n blinkInterval?: number;\n}\n\n/**\n * StreamingText — renders text that \"streams in\" token by token with a blinking cursor.\n *\n * Useful for displaying AI response streams or typewriter-style text effects.\n *\n * - When `speed === 0`: shows full text immediately, cursor blinks at end.\n * - When `speed > 0`: reveals `speed` chars per `tick()` call until complete.\n * - Cursor blinks every `blinkInterval` ms via the shared timer pool.\n */\nexport class StreamingText extends Widget {\n private _text: string;\n private _cursor: string;\n private _speed: number;\n private _blinkInterval: number;\n /** Number of characters currently revealed (used when speed > 0) */\n private _revealed: number;\n private _cursorVisible: boolean;\n private _blinkUnsub?: () => void;\n\n constructor(options: StreamingTextOptions, style: Partial<Style> = {}) {\n super(style);\n this._text = options.text;\n this._cursor = options.cursor ?? (caps.unicode ? '▋' : '_');\n this._speed = options.speed ?? 0;\n this._blinkInterval = options.blinkInterval ?? 530;\n this._revealed = 0;\n this._cursorVisible = true;\n }\n\n /** Replace text content and reset the revealed counter to 0. */\n setText(text: string): void {\n this._text = text;\n this._revealed = 0;\n this.markDirty();\n }\n\n /**\n * Advance `_revealed` by `speed` characters.\n * Call this from an external tick/render loop when `speed > 0`.\n */\n tick(): void {\n if (this._speed <= 0 || this.isComplete()) return;\n this._revealed = Math.min(this._revealed + this._speed, this._text.length);\n this.markDirty();\n }\n\n /** Returns true when all text has been revealed. */\n isComplete(): boolean {\n if (this._speed === 0) return true;\n return this._revealed >= this._text.length;\n }\n\n /** Lifecycle: start the blink timer (only when motion is enabled). */\n mount(): void {\n super.mount();\n if (!caps.motion) {\n this._cursorVisible = false; // Don't show cursor in reduced-motion\n return;\n }\n this._blinkUnsub = timerPoolSubscribe(this._blinkInterval, () => {\n this._cursorVisible = !this._cursorVisible;\n this.markDirty();\n });\n }\n\n /** Lifecycle: stop the blink timer. */\n unmount(): void {\n this._blinkUnsub?.();\n this._blinkUnsub = undefined;\n super.unmount();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Determine how much text to display\n const displayText = this._speed > 0\n ? this._text.slice(0, this._revealed)\n : this._text;\n\n // Append cursor if visible\n const fullText = this._cursorVisible\n ? displayText + this._cursor\n : displayText;\n\n // Word-wrap to fit within content width\n const wrapped = wordWrap(fullText, width);\n const lines = wrapped.split('\\n');\n\n // Render up to rect.height lines\n const limit = Math.min(lines.length, height);\n for (let i = 0; i < limit; i++) {\n const line = lines[i];\n if (line === undefined) continue;\n screen.writeString(x, y + i, line, attrs);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ChatMessage widget\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type NamedColor,\n styleToCellAttrs,\n stringWidth,\n truncate,\n wordWrap,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type MessageRole = 'user' | 'assistant' | 'system' | 'tool';\n\nexport interface ChatMessageOptions {\n role: MessageRole;\n content: string;\n timestamp?: Date;\n}\n\n// ── Role configuration ────────────────────────────────\n\nconst ROLE_CONFIG: Record<MessageRole, { badge: string; colorName: string }> = {\n user: { badge: '[User]', colorName: 'cyan' },\n assistant: { badge: '[Assistant]', colorName: 'green' },\n system: { badge: '[System]', colorName: 'yellow' },\n tool: { badge: '[Tool]', colorName: 'magenta' },\n};\n\n// ── ChatMessage widget ────────────────────────────────\n\n/**\n * ChatMessage — displays a single chat message with a colored role badge\n * and word-wrapped content text.\n *\n * Layout:\n * Row 0: [Role badge] (colored) optional timestamp (dim, right-aligned)\n * Row 1..N: content text, word-wrapped, indented 2 spaces\n */\nexport class ChatMessage extends Widget {\n private _role: MessageRole;\n private _content: string;\n private _timestamp?: Date;\n\n constructor(options: ChatMessageOptions, style: Partial<Style> = {}) {\n super(style);\n this._role = options.role;\n this._content = options.content;\n this._timestamp = options.timestamp;\n this.focusable = false;\n }\n\n /** Update the message content and mark dirty. */\n setContent(content: string): void {\n this._content = content;\n this.markDirty();\n }\n\n /** Update the message role and mark dirty. */\n setRole(role: MessageRole): void {\n this._role = role;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const config = ROLE_CONFIG[this._role];\n const baseAttrs = styleToCellAttrs(this._style);\n\n // ── Row 0: badge + optional timestamp ────────────\n const badgeAttrs = {\n ...baseAttrs,\n fg: { type: 'named' as const, name: config.colorName as NamedColor },\n };\n screen.writeString(x, y, config.badge, badgeAttrs);\n\n if (this._timestamp) {\n const ts = this._timestamp.toLocaleTimeString('en-GB', {\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: false,\n });\n const tsWidth = stringWidth(ts);\n const tsX = x + width - tsWidth;\n // Only draw if it fits without overlapping the badge\n if (tsX > x + stringWidth(config.badge)) {\n const dimAttrs = { ...baseAttrs, dim: true };\n screen.writeString(tsX, y, ts, dimAttrs);\n }\n }\n\n // ── Rows 1..N: content text ───────────────────────\n if (height <= 1) return;\n\n const indent = ' ';\n const contentWidth = Math.max(0, width - indent.length);\n const lines = contentWidth > 0 ? wordWrap(this._content, contentWidth).split('\\n') : [];\n const maxContentRows = height - 1;\n\n for (let i = 0; i < Math.min(lines.length, maxContentRows); i++) {\n const line = lines[i];\n if (line === undefined) continue;\n const displayLine = truncate(indent + line, width);\n screen.writeString(x, y + 1 + i, displayLine, baseAttrs);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ToolCall and ToolApproval widgets\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type NamedColor,\n styleToCellAttrs,\n truncate,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n// ── Types ─────────────────────────────────────────────\n\nexport type ToolCallStatus = 'pending' | 'running' | 'done' | 'error';\n\nexport interface ToolCallOptions {\n name: string;\n args: Record<string, unknown>;\n result?: unknown;\n status: ToolCallStatus;\n collapsed?: boolean; // default: true\n}\n\nexport interface ToolApprovalOptions extends ToolCallOptions {\n onApprove?: () => void;\n onDeny?: () => void;\n}\n\n// ── Status configuration ──────────────────────────────\n\ninterface StatusConfig {\n unicodeSymbol: string;\n asciiSymbol: string;\n colorName: string;\n bold?: boolean;\n dim?: boolean;\n}\n\nconst STATUS_CONFIG: Record<ToolCallStatus, StatusConfig> = {\n pending: { unicodeSymbol: '◌', asciiSymbol: '?', colorName: 'white', dim: true },\n running: { unicodeSymbol: '◎', asciiSymbol: '~', colorName: 'yellow' },\n done: { unicodeSymbol: '✓', asciiSymbol: '+', colorName: 'green' },\n error: { unicodeSymbol: '✗', asciiSymbol: '!', colorName: 'red' },\n};\n\n// ── ToolCall widget ───────────────────────────────────\n\n/**\n * ToolCall — displays an AI tool invocation with status indicator,\n * tool name, arguments, and optional result.\n *\n * Layout (expanded):\n * Row 0: ▶/▼ tool_name [status-symbol] [status-label]\n * Row 1+: \" arg: value\" (one per arg, 2-space indent)\n * (if done/error and result present): \" result: ...\"\n *\n * Space or Enter toggles collapsed/expanded state.\n */\nexport class ToolCall extends Widget {\n protected _name: string;\n protected _args: Record<string, unknown>;\n protected _result: unknown;\n protected _status: ToolCallStatus;\n protected _collapsed: boolean;\n\n constructor(options: ToolCallOptions, style: Partial<Style> = {}) {\n super(style);\n this._name = options.name;\n this._args = options.args;\n this._result = options.result;\n this._status = options.status;\n this._collapsed = options.collapsed ?? true;\n this.focusable = true;\n }\n\n // ── Public API ─────────────────────────────────────\n\n setStatus(status: ToolCallStatus): void {\n this._status = status;\n this.markDirty();\n }\n\n setResult(result: unknown): void {\n this._result = result;\n this.markDirty();\n }\n\n collapse(): void {\n this._collapsed = true;\n this.markDirty();\n }\n\n expand(): void {\n this._collapsed = false;\n this.markDirty();\n }\n\n handleKey(key: string): void {\n if (key === ' ' || key === 'Enter') {\n this._collapsed = !this._collapsed;\n this.markDirty();\n }\n }\n\n // ── Rendering ──────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const useUnicode = caps.unicode;\n const baseAttrs = styleToCellAttrs(this._style);\n const config = STATUS_CONFIG[this._status];\n\n // ── Row 0: chevron + name + status ────────────────\n const collapsedChevron = useUnicode ? '▶' : '>';\n const expandedChevron = useUnicode ? '▼' : 'v';\n const chevron = this._collapsed ? collapsedChevron : expandedChevron;\n const symbol = useUnicode ? config.unicodeSymbol : config.asciiSymbol;\n\n const statusAttrs = {\n ...baseAttrs,\n fg: { type: 'named' as const, name: config.colorName as NamedColor },\n bold: config.bold ?? false,\n dim: config.dim ?? false,\n };\n\n // Build header line: \"▶ tool_name [symbol] [status]\"\n const headerText = `${chevron} ${this._name} ${symbol} [${this._status}]`;\n screen.writeString(x, y, truncate(headerText, width), baseAttrs);\n\n // Colorize the status symbol within the header\n const symbolOffset = chevron.length + 1 + this._name.length + 1;\n if (symbolOffset < width) {\n screen.writeString(x + symbolOffset, y, symbol, statusAttrs);\n }\n\n if (this._collapsed) return;\n\n // ── Rows 1+: args ─────────────────────────────────\n let row = 1;\n const argEntries = Object.entries(this._args);\n\n for (const [key, value] of argEntries) {\n if (row >= height) break;\n const argLine = ` ${key}: ${JSON.stringify(value)}`;\n screen.writeString(x, y + row, truncate(argLine, width), baseAttrs);\n row++;\n }\n\n // ── Result row (done/error) ───────────────────────\n if (\n row < height &&\n this._result !== undefined &&\n (this._status === 'done' || this._status === 'error')\n ) {\n const resultStr = typeof this._result === 'string'\n ? this._result\n : JSON.stringify(this._result);\n const resultLine = ` result: ${resultStr}`;\n screen.writeString(x, y + row, truncate(resultLine, width), baseAttrs);\n }\n }\n}\n\n// ── ToolApproval widget ───────────────────────────────\n\n/**\n * ToolApproval — extends ToolCall with an approval prompt row.\n * When focused, shows \"[y] Approve [n] Deny\" after the args/result.\n * y/Enter calls onApprove; n/Escape calls onDeny.\n */\nexport class ToolApproval extends ToolCall {\n private _onApprove?: () => void;\n private _onDeny?: () => void;\n\n constructor(options: ToolApprovalOptions, style: Partial<Style> = {}) {\n super(options, style);\n this._onApprove = options.onApprove;\n this._onDeny = options.onDeny;\n }\n\n protected _renderSelf(screen: Screen): void {\n // Render the base ToolCall first\n super._renderSelf(screen);\n\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n // Calculate row after the header + args + result\n let rowsUsed = 1; // header row\n if (!this._collapsed) {\n rowsUsed += Object.keys(this._args).length;\n if (\n this._result !== undefined &&\n (this._status === 'done' || this._status === 'error')\n ) {\n rowsUsed += 1;\n }\n }\n\n const approvalRow = y + rowsUsed;\n if (approvalRow >= y + height) return;\n\n const baseAttrs = styleToCellAttrs(this._style);\n\n const approveAttrs = {\n ...baseAttrs,\n fg: { type: 'named' as const, name: 'green' as const },\n bold: true,\n };\n const denyAttrs = {\n ...baseAttrs,\n fg: { type: 'named' as const, name: 'red' as const },\n bold: true,\n };\n\n const approveText = '[y] Approve';\n const denyText = '[n] Deny';\n\n screen.writeString(x, approvalRow, approveText, approveAttrs);\n const denyX = x + approveText.length + 2;\n if (denyX + denyText.length <= x + width) {\n screen.writeString(denyX, approvalRow, denyText, denyAttrs);\n }\n }\n\n handleKey(key: string): void {\n if (key === 'y' || key === 'Enter') {\n this._onApprove?.();\n } else if (key === 'n' || key === 'Escape') {\n this._onDeny?.();\n } else {\n super.handleKey(key);\n }\n }\n}\n","export interface ScrollRange {\n start: number; // first item index to render\n end: number; // one past last item index to render (exclusive)\n offsetPx: number; // scroll offset in pixels (for variable height)\n}\n\n/**\n * Compute visible range for fixed-height items.\n * @param scrollOffset - first visible item index (scroll position in items, NOT pixels)\n * @param viewportItems - number of items visible in the viewport\n * @param itemCount - total number of items\n * @param overscan - extra items to render beyond viewport edges (default: 2)\n */\nexport function computeRange(\n scrollOffset: number,\n viewportItems: number,\n itemCount: number,\n overscan = 2,\n): ScrollRange {\n const start = Math.max(0, scrollOffset - overscan);\n const end = Math.min(itemCount, scrollOffset + viewportItems + overscan);\n return { start, end, offsetPx: start };\n}\n\n/**\n * Compute visible range for variable-height items.\n * @param scrollPx - scroll position in pixels\n * @param viewportPx - viewport height in pixels\n * @param sizes - array of item heights in pixels\n * @param overscan - extra items to render (default: 2)\n */\nexport function computeVariableRange(\n scrollPx: number,\n viewportPx: number,\n sizes: number[],\n overscan = 2,\n): ScrollRange {\n const cumulative: number[] = [];\n let sum = 0;\n for (const s of sizes) {\n cumulative.push(sum);\n sum += s;\n }\n cumulative.push(sum); // sentinel\n\n // First item that starts within or before the viewport\n let startIdx = cumulative.findIndex((c, i) => i < sizes.length && c + sizes[i] > scrollPx);\n if (startIdx < 0) startIdx = sizes.length;\n startIdx = Math.max(0, startIdx - overscan);\n\n // Last item that starts before viewport end\n const viewportEnd = scrollPx + viewportPx;\n let endIdx = cumulative.findIndex((c) => c >= viewportEnd);\n if (endIdx < 0) endIdx = sizes.length;\n endIdx = Math.min(sizes.length, endIdx + overscan);\n\n return { start: startIdx, end: endIdx, offsetPx: cumulative[startIdx] };\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — List widget (selectable)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface ListItem {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\n/**\n * List — a scrollable, selectable list of items.\n *\n * Supports:\n * - Keyboard navigation (up/down/Home/End)\n * - Scrolling when items exceed visible height\n * - Custom item styling\n * - Disabled items\n */\nexport class List extends Widget {\n private _items: ListItem[];\n private _selectedIndex = 0;\n private _scrollOffset = 0;\n private _onSelect?: (item: ListItem, index: number) => void;\n\n constructor(\n items: ListItem[],\n style: Partial<Style> = {},\n onSelect?: (item: ListItem, index: number) => void,\n ) {\n super({ border: 'single', ...style });\n this._items = items;\n this._onSelect = onSelect;\n this.focusable = true;\n }\n\n get selectedIndex(): number { return this._selectedIndex; }\n get selectedItem(): ListItem | undefined { return this._items[this._selectedIndex]; }\n\n setItems(items: ListItem[]): void {\n this._items = items;\n this._selectedIndex = Math.min(this._selectedIndex, items.length - 1);\n this._clampScroll();\n this.markDirty();\n }\n\n /** Move selection up */\n selectPrev(): void {\n let next = this._selectedIndex - 1;\n while (next >= 0 && this._items[next].disabled) next--;\n if (next >= 0) {\n this._selectedIndex = next;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Move selection down */\n selectNext(): void {\n let next = this._selectedIndex + 1;\n while (next < this._items.length && this._items[next].disabled) next++;\n if (next < this._items.length) {\n this._selectedIndex = next;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Confirm the current selection */\n confirm(): void {\n const item = this._items[this._selectedIndex];\n if (item && !item.disabled) {\n this._onSelect?.(item, this._selectedIndex);\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const visibleCount = Math.min(this._items.length - this._scrollOffset, height);\n\n for (let i = 0; i < visibleCount; i++) {\n const itemIdx = this._scrollOffset + i;\n const item = this._items[itemIdx];\n const isSelected = itemIdx === this._selectedIndex;\n\n // Compose the line\n const prefix = isSelected ? (caps.unicode ? '▸ ' : '> ') : ' ';\n let line = prefix + item.label;\n line = truncate(line, width);\n\n // Style\n const cellStyle = {\n ...attrs,\n bold: isSelected,\n dim: item.disabled ?? false,\n inverse: isSelected && this.isFocused,\n };\n\n screen.writeString(x, y + i, line, cellStyle);\n\n // Fill rest of line for inverse highlight\n if (isSelected && this.isFocused) {\n const remaining = width - stringWidth(line);\n for (let c = 0; c < remaining; c++) {\n screen.setCell(x + stringWidth(line) + c, y + i, { char: ' ', ...cellStyle });\n }\n }\n }\n\n // Scrollbar indicator\n if (this._items.length > height) {\n const scrollRatio = this._scrollOffset / (this._items.length - height);\n const scrollPos = Math.floor(scrollRatio * (height - 1));\n for (let r = 0; r < height; r++) {\n const scrollChar = r === scrollPos ? (caps.unicode ? '█' : '#') : (caps.unicode ? '░' : '-');\n screen.setCell(x + width - 1, y + r, { char: scrollChar, ...attrs, dim: true });\n }\n }\n }\n\n private _clampScroll(): void {\n const rect = this._getContentRect();\n const visibleHeight = rect.height;\n if (visibleHeight <= 0) { this._scrollOffset = 0; return; }\n\n if (this._selectedIndex < this._scrollOffset) {\n this._scrollOffset = this._selectedIndex;\n }\n if (this._selectedIndex >= this._scrollOffset + visibleHeight) {\n this._scrollOffset = this._selectedIndex - visibleHeight + 1;\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — TextInput widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * TextInput — a single-line text input field.\n *\n * Supports:\n * - Cursor movement (left/right/Home/End)\n * - Character insertion and deletion\n * - Placeholder text\n * - Password masking\n * - Max length constraint\n */\nexport class TextInput extends Widget {\n private _value = '';\n private _cursorPos = 0;\n private _placeholder: string;\n private _mask: string | null;\n private _maxLength: number;\n private _onChange?: (value: string) => void;\n private _onSubmit?: (value: string) => void;\n\n constructor(\n style: Partial<Style> = {},\n options: {\n placeholder?: string;\n mask?: string;\n maxLength?: number;\n onChange?: (value: string) => void;\n onSubmit?: (value: string) => void;\n } = {},\n ) {\n super({ border: 'single', height: 3, ...style });\n this._placeholder = options.placeholder ?? '';\n this._mask = options.mask ?? null;\n this._maxLength = options.maxLength ?? Infinity;\n this._onChange = options.onChange;\n this._onSubmit = options.onSubmit;\n this.focusable = true;\n }\n\n get value(): string { return this._value; }\n set value(v: string) {\n this._value = v.slice(0, this._maxLength);\n this._cursorPos = Math.min(this._cursorPos, this._value.length);\n }\n\n /**\n * Handle a typed character.\n */\n insertChar(char: string): void {\n if (this._value.length >= this._maxLength) return;\n this._value =\n this._value.slice(0, this._cursorPos) +\n char +\n this._value.slice(this._cursorPos);\n this._cursorPos++;\n this._onChange?.(this._value);\n }\n\n /**\n * Delete the character before the cursor.\n */\n deleteBack(): void {\n if (this._cursorPos > 0) {\n this._value =\n this._value.slice(0, this._cursorPos - 1) +\n this._value.slice(this._cursorPos);\n this._cursorPos--;\n this._onChange?.(this._value);\n }\n }\n\n /**\n * Delete the character after the cursor.\n */\n deleteForward(): void {\n if (this._cursorPos < this._value.length) {\n this._value =\n this._value.slice(0, this._cursorPos) +\n this._value.slice(this._cursorPos + 1);\n this._onChange?.(this._value);\n }\n }\n\n moveCursorLeft(): void { this._cursorPos = Math.max(0, this._cursorPos - 1); }\n moveCursorRight(): void { this._cursorPos = Math.min(this._value.length, this._cursorPos + 1); }\n moveCursorHome(): void { this._cursorPos = 0; }\n moveCursorEnd(): void { this._cursorPos = this._value.length; }\n submit(): void { this._onSubmit?.(this._value); }\n clear(): void { this._value = ''; this._cursorPos = 0; this._onChange?.(''); }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n if (this._value.length === 0 && !this.isFocused) {\n // Show placeholder\n screen.writeString(x, y, truncate(this._placeholder, width), { ...attrs, dim: true });\n return;\n }\n\n // Display value (optionally masked)\n const displayValue = this._mask\n ? this._mask.repeat(this._value.length)\n : this._value;\n\n // Scroll the view if cursor is beyond visible area\n const visibleWidth = width - 1; // Leave room for cursor\n let scrollX = 0;\n if (this._cursorPos > visibleWidth) {\n scrollX = this._cursorPos - visibleWidth;\n }\n\n const visibleText = displayValue.slice(scrollX, scrollX + visibleWidth);\n screen.writeString(x, y, visibleText, attrs);\n\n // Draw cursor when focused\n if (this.isFocused) {\n const cursorScreenPos = x + this._cursorPos - scrollX;\n if (cursorScreenPos >= x && cursorScreenPos < x + width) {\n const cursorChar = this._cursorPos < displayValue.length\n ? displayValue[this._cursorPos]\n : ' ';\n screen.setCell(cursorScreenPos, y, {\n char: cursorChar,\n ...attrs,\n inverse: true,\n });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — VirtualList (scroll virtualization)\n//\n// Renders only the visible rows of a large dataset.\n// Supports keyboard navigation, custom item rendering,\n// and variable-height items.\n//\n// Usage:\n// const list = new VirtualList({\n// totalItems: 100_000,\n// itemHeight: 1,\n// renderItem: (index) => `Row #${index}`,\n// });\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, truncate, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { computeRange } from './virtual-scroll.js';\n\nexport interface VirtualListOptions {\n /** Total number of items (the full dataset size) */\n totalItems: number;\n /** Height of each item in rows (default: 1) */\n itemHeight?: number;\n /** Render function: returns the string content for an item at a given index */\n renderItem: (index: number) => string;\n /** Style overrides */\n style?: Partial<Style>;\n /** Callback when an item is selected (Enter key) */\n onSelect?: (index: number) => void;\n /** Number of overscan rows to render above/below the viewport (default: 2) */\n overscan?: number;\n /** Show scrollbar (default: true) */\n showScrollbar?: boolean;\n}\n\n/**\n * VirtualList — a scroll-virtualized list widget.\n *\n * Only renders the items visible in the viewport plus\n * a small overscan buffer, enabling smooth scrolling\n * through datasets of any size.\n *\n * Performance:\n * - 100 items → renders ~26 rows\n * - 1,000,000 items → still renders only ~26 rows\n */\nexport class VirtualList extends Widget {\n private _totalItems: number;\n private _itemHeight: number;\n private _renderItem: (index: number) => string;\n private _onSelect?: (index: number) => void;\n private _selectedIndex = 0;\n private _scrollOffset = 0;\n private _overscan: number;\n private _showScrollbar: boolean;\n\n constructor(options: VirtualListOptions) {\n super({ border: 'single', ...options.style });\n this._totalItems = options.totalItems;\n this._itemHeight = options.itemHeight ?? 1;\n this._renderItem = options.renderItem;\n this._onSelect = options.onSelect;\n this._overscan = options.overscan ?? 2;\n this._showScrollbar = options.showScrollbar ?? true;\n this.focusable = true;\n }\n\n // ── Getters ──\n\n get totalItems(): number { return this._totalItems; }\n get selectedIndex(): number { return this._selectedIndex; }\n get scrollOffset(): number { return this._scrollOffset; }\n\n // ── Public API ──\n\n /** Update the total item count (e.g., after data refresh) */\n setTotalItems(count: number): void {\n this._totalItems = count;\n this._selectedIndex = Math.min(this._selectedIndex, Math.max(0, count - 1));\n this._clampScroll();\n this.markDirty();\n }\n\n /** Update the render function (e.g., when data changes) */\n setRenderItem(fn: (index: number) => string): void {\n this._renderItem = fn;\n this.markDirty();\n }\n\n /** Move selection up by one */\n selectPrev(): void {\n if (this._selectedIndex > 0) {\n this._selectedIndex--;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Move selection down by one */\n selectNext(): void {\n if (this._selectedIndex < this._totalItems - 1) {\n this._selectedIndex++;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Jump to the first item */\n selectFirst(): void {\n this._selectedIndex = 0;\n this._clampScroll();\n this.markDirty();\n }\n\n /** Jump to the last item */\n selectLast(): void {\n this._selectedIndex = Math.max(0, this._totalItems - 1);\n this._clampScroll();\n this.markDirty();\n }\n\n /** Page up — move by viewport height */\n pageUp(): void {\n const rect = this._getContentRect();\n const pageSize = Math.floor(rect.height / this._itemHeight);\n this._selectedIndex = Math.max(0, this._selectedIndex - pageSize);\n this._clampScroll();\n this.markDirty();\n }\n\n /** Page down — move by viewport height */\n pageDown(): void {\n const rect = this._getContentRect();\n const pageSize = Math.floor(rect.height / this._itemHeight);\n this._selectedIndex = Math.min(this._totalItems - 1, this._selectedIndex + pageSize);\n this._clampScroll();\n this.markDirty();\n }\n\n /** Scroll to a specific index */\n scrollTo(index: number): void {\n this._selectedIndex = Math.max(0, Math.min(index, this._totalItems - 1));\n this._clampScroll();\n this.markDirty();\n }\n\n /** Confirm the current selection */\n confirm(): void {\n if (this._totalItems > 0) {\n this._onSelect?.(this._selectedIndex);\n }\n }\n\n // ── Rendering ──\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._totalItems === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const visibleItemCount = Math.floor(height / this._itemHeight);\n\n // Calculate the visible window with overscan\n const { start: startIdx, end: endIdx } = computeRange(\n this._scrollOffset, visibleItemCount, this._totalItems, this._overscan,\n );\n\n // Content width (leave room for scrollbar)\n const contentWidth = this._showScrollbar && this._totalItems > visibleItemCount\n ? width - 1\n : width;\n\n // Only render items in the visible window\n for (let idx = startIdx; idx < endIdx; idx++) {\n const rowY = y + (idx - this._scrollOffset) * this._itemHeight;\n\n // Skip if outside the visible rect\n if (rowY < y || rowY >= y + height) continue;\n\n const isSelected = idx === this._selectedIndex;\n\n // Get the item content\n let content: string;\n try {\n content = this._renderItem(idx);\n } catch {\n content = `[Error: item ${idx}]`;\n }\n\n // Add selection prefix\n const prefix = isSelected ? (caps.unicode ? '▸ ' : '> ') : ' ';\n let line = prefix + content;\n line = truncate(line, contentWidth);\n\n // Style\n const cellStyle = {\n ...attrs,\n bold: isSelected,\n inverse: isSelected && this.isFocused,\n };\n\n screen.writeString(x, rowY, line, cellStyle);\n\n // Fill rest of line for inverse highlight\n if (isSelected && this.isFocused) {\n const remaining = contentWidth - stringWidth(line);\n for (let c = 0; c < remaining; c++) {\n screen.setCell(x + stringWidth(line) + c, rowY, { char: ' ', ...cellStyle });\n }\n }\n }\n\n // Scrollbar\n if (this._showScrollbar && this._totalItems > visibleItemCount) {\n const scrollbarX = x + width - 1;\n const totalPages = this._totalItems - visibleItemCount;\n const scrollRatio = totalPages > 0 ? this._scrollOffset / totalPages : 0;\n const thumbPos = Math.floor(scrollRatio * (height - 1));\n const thumbChar = caps.unicode ? '█' : '#';\n const trackChar = caps.unicode ? '░' : '|';\n\n for (let r = 0; r < height; r++) {\n const scrollChar = r === thumbPos ? thumbChar : trackChar;\n screen.setCell(scrollbarX, y + r, { char: scrollChar, ...attrs, dim: r !== thumbPos });\n }\n }\n }\n\n // ── Internal ──\n\n private _clampScroll(): void {\n const rect = this._getContentRect();\n const visibleHeight = Math.floor(rect.height / this._itemHeight);\n if (visibleHeight <= 0) { this._scrollOffset = 0; return; }\n\n // Keep selected item visible\n if (this._selectedIndex < this._scrollOffset) {\n this._scrollOffset = this._selectedIndex;\n }\n if (this._selectedIndex >= this._scrollOffset + visibleHeight) {\n this._scrollOffset = this._selectedIndex - visibleHeight + 1;\n }\n\n // Clamp scroll offset\n this._scrollOffset = Math.max(0, Math.min(this._scrollOffset, this._totalItems - visibleHeight));\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — CommandPalette widget\n//\n// A fuzzy-search overlay widget. Shows a floating box\n// with a text input and a filtered list of commands.\n//\n// Usage:\n// const palette = new CommandPalette({\n// commands: [\n// { id: 'open', label: 'Open File', description: 'Ctrl+O', action: () => {} },\n// ],\n// onClose: () => palette.setStyle({ visible: false }),\n// });\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface Command {\n id: string;\n label: string;\n description?: string;\n action: () => void;\n}\n\nexport interface CommandPaletteOptions {\n commands: Command[];\n onClose?: () => void;\n /** Placeholder shown when query is empty. Default: 'Type to search...' */\n placeholder?: string;\n /** Max number of commands shown at once. Default: 8 */\n maxVisible?: number;\n}\n\n/**\n * CommandPalette — a fuzzy-search overlay widget.\n *\n * Renders a floating panel with:\n * - Row 0: `> ` + query text (or placeholder when empty)\n * - Rows 1..N: filtered command list with label + description\n *\n * Key bindings:\n * - Printable chars: append to query\n * - Backspace: delete last query character\n * - ArrowUp / k: move selection up\n * - ArrowDown / j: move selection down\n * - Enter: execute selected command\n * - Escape: call onClose\n */\nexport class CommandPalette extends Widget {\n private _commands: Command[];\n private _filtered: Command[];\n private _query = '';\n private _selectedIndex = 0;\n private _options: CommandPaletteOptions;\n\n constructor(options: CommandPaletteOptions, style: Partial<Style> = {}) {\n super({ border: 'single', ...style });\n this._options = {\n placeholder: 'Type to search...',\n maxVisible: 8,\n ...options,\n };\n this._commands = options.commands;\n this._filtered = [...this._commands];\n this.focusable = true;\n }\n\n /** Update the full command list and re-filter. */\n setCommands(commands: Command[]): void {\n this._commands = commands;\n this._filter();\n this.markDirty();\n }\n\n /**\n * Reset query, re-filter all commands, reset selection.\n * Call this when opening the palette.\n */\n open(): void {\n this._query = '';\n this._selectedIndex = 0;\n this._filtered = [...this._commands];\n this.markDirty();\n }\n\n /** Current query string. */\n getQuery(): string {\n return this._query;\n }\n\n // ─── Private helpers ────────────────────────────────\n\n /** Filter commands based on current query (case-insensitive substring). */\n private _filter(): void {\n const q = this._query.toLowerCase();\n if (q === '') {\n this._filtered = [...this._commands];\n } else {\n this._filtered = this._commands.filter(\n (cmd) =>\n cmd.label.toLowerCase().includes(q) ||\n cmd.id.toLowerCase().includes(q),\n );\n }\n // Clamp selection to new filtered length\n const max = Math.max(0, this._filtered.length - 1);\n this._selectedIndex = Math.min(this._selectedIndex, max);\n }\n\n private _executeSelected(): void {\n const cmd = this._filtered[this._selectedIndex];\n if (cmd) {\n cmd.action();\n }\n }\n\n private _moveUp(): void {\n if (this._selectedIndex > 0) {\n this._selectedIndex--;\n }\n }\n\n private _moveDown(): void {\n const maxVisible = this._options.maxVisible ?? 8;\n const visibleCount = Math.min(this._filtered.length, maxVisible);\n if (this._selectedIndex < visibleCount - 1) {\n this._selectedIndex++;\n }\n }\n\n // ─── Key handling ────────────────────────────────────\n\n handleKey(key: string): void {\n switch (key) {\n case 'Escape':\n this._options.onClose?.();\n break;\n case 'Enter':\n this._executeSelected();\n break;\n case 'ArrowUp':\n case 'k':\n this._moveUp();\n break;\n case 'ArrowDown':\n case 'j':\n this._moveDown();\n break;\n case 'Backspace':\n this._query = this._query.slice(0, -1);\n this._filter();\n break;\n default:\n if (key.length === 1) {\n this._query += key;\n this._filter();\n }\n break;\n }\n this.markDirty();\n }\n\n // ─── Rendering ───────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const maxVisible = this._options.maxVisible ?? 8;\n const placeholder = this._options.placeholder ?? 'Type to search...';\n\n // ── Row 0: query line ──────────────────────────\n const prefix = '> ';\n const queryDisplay = this._query.length > 0 ? this._query : placeholder;\n const queryDim = this._query.length === 0;\n const queryLine = truncate(prefix + queryDisplay, width);\n\n screen.writeString(x, y, queryLine, { ...attrs, dim: queryDim });\n\n // Fill rest of query row with spaces (clean background)\n const queryLineWidth = stringWidth(queryLine);\n for (let c = queryLineWidth; c < width; c++) {\n screen.setCell(x + c, y, { char: ' ', ...attrs });\n }\n\n // ── Rows 1..N: command list ────────────────────\n const listStartRow = 1;\n const listHeight = height - listStartRow;\n const visibleCount = Math.min(this._filtered.length, maxVisible, listHeight);\n\n for (let i = 0; i < visibleCount; i++) {\n const cmd = this._filtered[i];\n const isSelected = i === this._selectedIndex;\n const rowY = y + listStartRow + i;\n\n // Compose left part: prefix + label\n const rowPrefix = isSelected ? '▸ ' : ' ';\n const labelPart = rowPrefix + cmd.label;\n\n // Compose right part: description (dim, right-aligned)\n const desc = cmd.description ?? '';\n const descWidth = stringWidth(desc);\n\n // Available width for label (leave room for desc if it fits)\n const gap = 1; // minimum space between label and desc\n const labelMaxWidth = desc\n ? Math.max(0, width - descWidth - gap)\n : width;\n\n const labelTruncated = truncate(labelPart, labelMaxWidth);\n const labelWidth = stringWidth(labelTruncated);\n\n // Cell style for the row\n const cellStyle = {\n ...attrs,\n bold: isSelected,\n inverse: isSelected,\n };\n const dimStyle = {\n ...attrs,\n dim: true,\n inverse: isSelected,\n };\n\n // Write label\n screen.writeString(x, rowY, labelTruncated, cellStyle);\n\n // Fill gap between label and description\n if (desc) {\n const descX = x + width - descWidth;\n // Fill blank between label end and desc start\n for (let c = x + labelWidth; c < descX; c++) {\n screen.setCell(c, rowY, { char: ' ', ...cellStyle });\n }\n // Write description (right-aligned, dim)\n screen.writeString(descX, rowY, desc, dimStyle);\n } else {\n // Fill remainder of row for inverse highlight\n for (let c = x + labelWidth; c < x + width; c++) {\n screen.setCell(c, rowY, { char: ' ', ...cellStyle });\n }\n }\n }\n\n // Clear any rows below the visible commands (in case widget was larger)\n for (let i = visibleCount; i < listHeight; i++) {\n const rowY = y + listStartRow + i;\n for (let c = 0; c < width; c++) {\n screen.setCell(x + c, rowY, { char: ' ', ...attrs });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Table widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, stringWidth, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface TableColumn {\n /** Column header label */\n header: string;\n /** Key to pull data from row objects */\n key: string;\n /** Fixed width (chars). If omitted, auto-distributes. */\n width?: number;\n /** Text alignment within the column */\n align?: 'left' | 'center' | 'right';\n}\n\nexport type TableRow = Record<string, string | number>;\n\nexport interface TableOptions {\n /** Whether to show the header row */\n showHeader?: boolean;\n /** Color for the header row */\n headerColor?: Color;\n /** Whether rows are zebra-striped */\n stripe?: boolean;\n /** Stripe color */\n stripeColor?: Color;\n /** Column separator character */\n separator?: string;\n}\n\n/**\n * Table — renders tabular data with columns, headers, and optional zebra-striping.\n *\n * Supports:\n * - Auto-width column distribution\n * - Fixed and percentage widths\n * - Header styling\n * - Zebra striping\n * - Text alignment per column\n * - Truncation for overflow\n */\nexport class Table extends Widget {\n private _columns: TableColumn[];\n private _rows: TableRow[];\n private _showHeader: boolean;\n private _headerColor: Color;\n private _stripe: boolean;\n private _stripeColor: Color;\n private _separator: string;\n\n constructor(\n columns: TableColumn[],\n rows: TableRow[],\n style: Partial<Style> = {},\n options: TableOptions = {},\n ) {\n super(style);\n this._columns = columns;\n this._rows = rows;\n this._showHeader = options.showHeader ?? true;\n this._headerColor = options.headerColor ?? { type: 'named', name: 'cyan' };\n this._stripe = options.stripe ?? true;\n this._stripeColor = options.stripeColor ?? { type: 'named', name: 'brightBlack' };\n this._separator = options.separator ?? ' │ ';\n }\n\n setRows(rows: TableRow[]): void {\n this._rows = rows;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const sepWidth = stringWidth(this._separator);\n\n // Calculate column widths\n const colWidths = this._computeColumnWidths(\n width - (this._columns.length - 1) * sepWidth,\n );\n\n let row = 0;\n\n // Render header\n if (this._showHeader && row < height) {\n let cx = x;\n for (let c = 0; c < this._columns.length; c++) {\n const col = this._columns[c];\n const cellText = this._alignText(col.header, colWidths[c], col.align ?? 'left');\n screen.writeString(cx, y + row, cellText, {\n ...attrs,\n fg: this._headerColor,\n bold: true,\n });\n cx += colWidths[c];\n if (c < this._columns.length - 1) {\n screen.writeString(cx, y + row, this._separator, { ...attrs, dim: true });\n cx += sepWidth;\n }\n }\n row++;\n\n // Header separator line\n if (row < height) {\n const sepLine = '─'.repeat(width);\n screen.writeString(x, y + row, sepLine, { ...attrs, dim: true });\n row++;\n }\n }\n\n // Render data rows\n for (let r = 0; r < this._rows.length && row < height; r++) {\n const dataRow = this._rows[r];\n const isStripe = this._stripe && r % 2 === 1;\n let cx = x;\n\n for (let c = 0; c < this._columns.length; c++) {\n const col = this._columns[c];\n const rawValue = String(dataRow[col.key] ?? '');\n const cellText = this._alignText(rawValue, colWidths[c], col.align ?? 'left');\n\n screen.writeString(cx, y + row, cellText, {\n ...attrs,\n bg: isStripe ? this._stripeColor : attrs.bg,\n });\n cx += colWidths[c];\n if (c < this._columns.length - 1) {\n screen.writeString(cx, y + row, this._separator, {\n ...attrs,\n dim: true,\n bg: isStripe ? this._stripeColor : attrs.bg,\n });\n cx += sepWidth;\n }\n }\n\n // Fill remaining width for stripe\n if (isStripe) {\n for (let fx = cx; fx < x + width; fx++) {\n screen.setCell(fx, y + row, { char: ' ', bg: this._stripeColor });\n }\n }\n\n row++;\n }\n }\n\n private _computeColumnWidths(totalWidth: number): number[] {\n const fixedCols = this._columns.filter(c => c.width !== undefined);\n const flexCols = this._columns.filter(c => c.width === undefined);\n\n let usedWidth = fixedCols.reduce((sum, c) => sum + (c.width ?? 0), 0);\n const remainingWidth = Math.max(0, totalWidth - usedWidth);\n const flexWidth = flexCols.length > 0 ? Math.floor(remainingWidth / flexCols.length) : 0;\n\n return this._columns.map(c => c.width ?? flexWidth);\n }\n\n private _alignText(text: string, width: number, align: 'left' | 'center' | 'right'): string {\n const truncated = truncate(text, width);\n const textWidth = stringWidth(truncated);\n const pad = Math.max(0, width - textWidth);\n\n switch (align) {\n case 'right':\n return ' '.repeat(pad) + truncated;\n case 'center': {\n const left = Math.floor(pad / 2);\n const right = pad - left;\n return ' '.repeat(left) + truncated + ' '.repeat(right);\n }\n case 'left':\n default:\n return truncated + ' '.repeat(pad);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Gauge widget (label + bar + value)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface GaugeOptions {\n /** Color of the filled portion */\n color?: Color;\n /** Show percentage label */\n showLabel?: boolean;\n}\n\n/**\n * Gauge — a self-contained metric display with label, bar, and value.\n *\n * Example:\n * CPU ████████░░░░ 65%\n */\nexport class Gauge extends Widget {\n private _label: string;\n private _value: number = 0;\n private _color: Color;\n private _showLabel: boolean;\n\n constructor(label: string, style: Partial<Style> = {}, opts: GaugeOptions = {}) {\n super(style);\n this._label = label;\n this._color = opts.color ?? { type: 'named', name: 'green' };\n this._showLabel = opts.showLabel ?? true;\n }\n\n setValue(value: number): void {\n this._value = Math.max(0, Math.min(1, value));\n this.markDirty();\n }\n\n getValue(): number {\n return this._value;\n }\n\n setLabel(label: string): void {\n this._label = label;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Layout: \"Label ████████░░░░ XX%\"\n const labelStr = this._label + ' ';\n const percentStr = this._showLabel ? ` ${Math.round(this._value * 100)}%` : '';\n const labelWidth = stringWidth(labelStr);\n const percentWidth = stringWidth(percentStr);\n const barWidth = Math.max(0, width - labelWidth - percentWidth);\n\n // Render label\n screen.writeString(x, y, labelStr, { ...attrs, bold: true });\n\n // Render bar\n const filled = Math.round(barWidth * this._value);\n const barX = x + labelWidth;\n for (let i = 0; i < barWidth; i++) {\n const char = i < filled ? (caps.unicode ? '█' : '#') : (caps.unicode ? '░' : '-');\n screen.setCell(barX + i, y, {\n char,\n fg: i < filled ? this._color : { type: 'named', name: 'brightBlack' },\n });\n }\n\n // Render percentage\n if (this._showLabel) {\n screen.writeString(barX + barWidth, y, percentStr, {\n ...attrs,\n bold: true,\n });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Sparkline widget (braille chart)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface SparklineOptions {\n /** Color of the sparkline */\n color?: Color;\n /** Show min/max labels */\n showRange?: boolean;\n}\n\n// Sparkline characters (8 levels per cell, bottom to top)\n// Falls back to ASCII digits when unicode is not available.\nconst SPARK_CHARS_UNICODE = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];\nconst SPARK_CHARS_ASCII = ['1', '2', '3', '4', '5', '6', '7', '8'];\n\n/**\n * Sparkline — a compact inline chart showing a data trend.\n *\n * Example:\n * Latency ▂▃▅▇▅▃▂▁▃▅█▅▃\n */\nexport class Sparkline extends Widget {\n private _label: string;\n private _data: number[] = [];\n private _color: Color;\n private _showRange: boolean;\n\n constructor(label: string, style: Partial<Style> = {}, opts: SparklineOptions = {}) {\n super(style);\n this._label = label;\n this._color = opts.color ?? { type: 'named', name: 'cyan' };\n this._showRange = opts.showRange ?? false;\n }\n\n setData(data: number[]): void {\n this._data = data;\n this.markDirty();\n }\n\n pushValue(value: number): void {\n this._data.push(value);\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const labelStr = this._label + ' ';\n const labelWidth = labelStr.length;\n\n // Render label\n screen.writeString(x, y, labelStr, { ...attrs, bold: true });\n\n // Available sparkline width\n const sparkWidth = width - labelWidth;\n if (sparkWidth <= 0 || this._data.length === 0) return;\n\n // Take the most recent data points that fit\n const data = this._data.slice(-sparkWidth);\n\n // Normalize data to 0–7 range\n const min = Math.min(...data);\n const max = Math.max(...data);\n const range = max - min || 1;\n\n const sparkChars = caps.unicode ? SPARK_CHARS_UNICODE : SPARK_CHARS_ASCII;\n for (let i = 0; i < data.length; i++) {\n const normalized = (data[i] - min) / range;\n const charIdx = Math.min(7, Math.floor(normalized * 8));\n screen.setCell(x + labelWidth + i, y, {\n char: sparkChars[charIdx],\n fg: this._color,\n });\n }\n\n // Optional range labels on second line\n if (this._showRange && height > 1) {\n const rangeStr = `${min.toFixed(0)}–${max.toFixed(0)}`;\n screen.writeString(x + labelWidth, y + 1, rangeStr, {\n ...attrs,\n dim: true,\n });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — StatusIndicator widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface StatusIndicatorOptions {\n /** Color when up/active */\n upColor?: Color;\n /** Color when down/inactive */\n downColor?: Color;\n}\n\n/**\n * StatusIndicator — simple up/down indicator with label.\n *\n * Example:\n * ● API Server — Online\n * ○ Worker — Offline\n */\nexport class StatusIndicator extends Widget {\n private _label: string;\n private _isUp: boolean;\n private _upColor: Color;\n private _downColor: Color;\n\n constructor(label: string, isUp: boolean, style: Partial<Style> = {}, opts: StatusIndicatorOptions = {}) {\n super(style);\n this._label = label;\n this._isUp = isUp;\n this._upColor = opts.upColor ?? { type: 'named', name: 'green' };\n this._downColor = opts.downColor ?? { type: 'named', name: 'red' };\n }\n\n setStatus(isUp: boolean): void {\n this._isUp = isUp;\n }\n\n getStatus(): boolean {\n return this._isUp;\n }\n\n setLabel(label: string): void {\n this._label = label;\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const dot = this._isUp ? '●' : '○';\n const statusText = this._isUp ? 'Online' : 'Offline';\n const color = this._isUp ? this._upColor : this._downColor;\n\n screen.setCell(x, y, { char: dot, fg: color });\n screen.writeString(x + 2, y, `${this._label} — ${statusText}`, {\n ...attrs,\n fg: color,\n });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — BarChart widget\n// Grouped bar chart with vertical and horizontal modes.\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen, type Style, type Color,\n styleToCellAttrs, stringWidth,\n VERTICAL_BAR_SYMBOLS, HORIZONTAL_BAR_SYMBOLS,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n// ── Types ────────────────────────────────────────────\n\nexport interface Bar {\n value: number;\n label?: string;\n color?: Color;\n}\n\nexport interface BarGroup {\n label?: string;\n bars: Bar[];\n}\n\nexport type BarChartDirection = 'vertical' | 'horizontal';\n\nexport interface BarChartOptions {\n /** Direction bars grow. Default: 'vertical'. */\n direction?: BarChartDirection;\n /** Width of each bar in cells. Default: 1. */\n barWidth?: number;\n /** Gap between bars in a group. Default: 1. */\n barGap?: number;\n /** Gap between groups. Default: 2. */\n groupGap?: number;\n /** Max value for scaling. Auto-detected if not set. */\n max?: number;\n /** Color for bars without a per-bar color. */\n barColor?: Color;\n /** Color for value labels. */\n valueColor?: Color;\n /** Color for text labels. */\n labelColor?: Color;\n}\n\n// ── Widget ───────────────────────────────────────────\n\nexport class BarChart extends Widget {\n private _data: BarGroup[] = [];\n private _direction: BarChartDirection;\n private _barWidth: number;\n private _barGap: number;\n private _groupGap: number;\n private _max?: number;\n private _barColor: Color;\n private _valueColor: Color;\n private _labelColor: Color;\n\n constructor(data: BarGroup[], style: Partial<Style> = {}, opts: BarChartOptions = {}) {\n super(style);\n this._data = data;\n this._direction = opts.direction ?? 'vertical';\n this._barWidth = opts.barWidth ?? 1;\n this._barGap = opts.barGap ?? 1;\n this._groupGap = opts.groupGap ?? 2;\n this._max = opts.max;\n this._barColor = opts.barColor ?? { type: 'named', name: 'cyan' };\n this._valueColor = opts.valueColor ?? { type: 'named', name: 'white' };\n this._labelColor = opts.labelColor ?? { type: 'named', name: 'brightBlack' };\n }\n\n setData(data: BarGroup[]): void {\n this._data = data;\n this.markDirty();\n }\n\n setMax(max: number | undefined): void {\n this._max = max;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._data.length === 0) return;\n\n const maxVal = this._computeMax();\n if (maxVal === 0) return;\n\n if (this._direction === 'vertical') {\n this._renderVertical(screen, x, y, width, height, maxVal);\n } else {\n this._renderHorizontal(screen, x, y, width, height, maxVal);\n }\n }\n\n private _computeMax(): number {\n if (this._max !== undefined) return this._max;\n let max = 0;\n for (const group of this._data) {\n for (const bar of group.bars) {\n if (bar.value > max) max = bar.value;\n }\n }\n return max;\n }\n\n // ── Vertical Rendering ───────────────────────────\n\n private _renderVertical(\n screen: Screen, ox: number, oy: number,\n width: number, height: number, maxVal: number,\n ): void {\n const valueRows = 1;\n const hasLabels = this._data.some(g =>\n g.bars.some(b => b.label !== undefined)\n );\n const labelRows = hasLabels ? 1 : 0;\n const hasGroupLabels = this._data.some(g => g.label !== undefined);\n const groupLabelRows = hasGroupLabels ? 1 : 0;\n const reservedRows = valueRows + labelRows + groupLabelRows;\n\n if (height <= reservedRows) return;\n\n const barAreaHeight = height - reservedRows;\n let cx = ox;\n\n for (let gi = 0; gi < this._data.length; gi++) {\n const group = this._data[gi];\n if (!group) continue;\n const groupStartX = cx;\n\n for (let bi = 0; bi < group.bars.length; bi++) {\n const bar = group.bars[bi];\n if (!bar) continue;\n if (cx + this._barWidth > ox + width) break;\n\n const color = bar.color ?? this._barColor;\n\n // Draw bar from bottom up using sub-cell symbols (8 levels per cell)\n const scaledHeight = (bar.value / maxVal) * (barAreaHeight * 8);\n let remaining = Math.round(scaledHeight);\n\n for (let row = barAreaHeight - 1; row >= 0; row--) {\n if (remaining <= 0) break;\n const level = Math.min(remaining, 8);\n const symbol = VERTICAL_BAR_SYMBOLS[level] ?? ' ';\n const cellY = oy + row;\n\n for (let col = 0; col < this._barWidth; col++) {\n const cellX = cx + col;\n if (cellX < ox + width) {\n screen.setCell(cellX, cellY, { char: symbol, fg: color });\n }\n }\n remaining -= 8;\n }\n\n // Value text below bar\n const valStr = Math.round(bar.value).toString();\n const valX = cx + Math.floor((this._barWidth - stringWidth(valStr)) / 2);\n screen.writeString(\n Math.max(cx, valX), oy + barAreaHeight,\n valStr.slice(0, this._barWidth),\n { fg: this._valueColor },\n );\n\n // Bar label below value\n if (hasLabels && bar.label) {\n const label = bar.label.slice(0, this._barWidth);\n const labelX = cx + Math.floor((this._barWidth - stringWidth(label)) / 2);\n screen.writeString(\n Math.max(cx, labelX), oy + barAreaHeight + valueRows,\n label,\n { fg: this._labelColor },\n );\n }\n\n cx += this._barWidth;\n if (bi < group.bars.length - 1) cx += this._barGap;\n }\n\n // Group label at bottom\n if (hasGroupLabels && group.label) {\n const groupWidth = cx - groupStartX;\n const label = group.label.slice(0, groupWidth);\n const labelX = groupStartX + Math.floor((groupWidth - stringWidth(label)) / 2);\n screen.writeString(\n Math.max(groupStartX, labelX), oy + height - 1,\n label,\n { fg: this._labelColor },\n );\n }\n\n if (gi < this._data.length - 1) cx += this._groupGap;\n }\n }\n\n // ── Horizontal Rendering ─────────────────────────\n\n private _renderHorizontal(\n screen: Screen, ox: number, oy: number,\n width: number, height: number, maxVal: number,\n ): void {\n // Compute label column width\n let maxLabelWidth = 0;\n let maxValueWidth = 0;\n for (const group of this._data) {\n for (const bar of group.bars) {\n if (bar.label) {\n const w = stringWidth(bar.label);\n if (w > maxLabelWidth) maxLabelWidth = w;\n }\n const vw = Math.round(bar.value).toString().length;\n if (vw > maxValueWidth) maxValueWidth = vw;\n }\n }\n\n const labelColWidth = maxLabelWidth > 0 ? maxLabelWidth + 1 : 0;\n const valueColWidth = maxValueWidth > 0 ? maxValueWidth + 1 : 0;\n const barAreaWidth = width - labelColWidth - valueColWidth;\n\n if (barAreaWidth <= 0) return;\n\n let cy = oy;\n\n for (let gi = 0; gi < this._data.length; gi++) {\n const group = this._data[gi];\n if (!group) continue;\n\n for (let bi = 0; bi < group.bars.length; bi++) {\n const bar = group.bars[bi];\n if (!bar) continue;\n\n for (let row = 0; row < this._barWidth; row++) {\n const cellY = cy + row;\n if (cellY >= oy + height) break;\n\n // Label on first row\n if (row === 0 && bar.label) {\n const label = bar.label.slice(0, maxLabelWidth);\n const padded = label.padStart(maxLabelWidth);\n screen.writeString(ox, cellY, padded, { fg: this._labelColor });\n }\n\n // Draw horizontal bar using sub-cell symbols\n const color = bar.color ?? this._barColor;\n const scaledWidth = (bar.value / maxVal) * (barAreaWidth * 8);\n let remaining = Math.round(scaledWidth);\n const barStartX = ox + labelColWidth;\n\n for (let col = 0; col < barAreaWidth; col++) {\n if (remaining <= 0) break;\n const level = Math.min(remaining, 8);\n const symbol = HORIZONTAL_BAR_SYMBOLS[level] ?? ' ';\n screen.setCell(barStartX + col, cellY, { char: symbol, fg: color });\n remaining -= 8;\n }\n\n // Value text on first row\n if (row === 0) {\n const valStr = Math.round(bar.value).toString();\n screen.writeString(\n ox + labelColWidth + barAreaWidth, cellY,\n ` ${valStr}`,\n { fg: this._valueColor },\n );\n }\n }\n\n cy += this._barWidth;\n if (bi < group.bars.length - 1) cy += this._barGap;\n }\n\n if (gi < this._data.length - 1) cy += this._groupGap;\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Grid layout widget\n// ─────────────────────────────────────────────────────\n\nimport type { Screen, Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { Box } from '../display/Box.js';\n\nexport interface GridOptions {\n /** Number of equal-width columns */\n columns: number;\n /** Gap between items in both directions (default: 1) */\n gap?: number;\n /** Row gap override (overrides gap for rows) */\n rowGap?: number;\n /** Column gap override (overrides gap for columns) */\n colGap?: number;\n}\n\n/**\n * Grid — a CSS-Grid-like layout widget.\n *\n * Items fill left-to-right, wrapping to a new row every `columns` items.\n * Internally creates a column-flex Box per row, each with equal-flex-grow items.\n *\n * The `addChild()` override means the reconciler's generic child-adding\n * loop works without any special casing.\n */\nexport class Grid extends Widget {\n private _columns: number;\n private _colGap: number;\n private _rowGap: number;\n private _rows: Box[] = [];\n private _itemCount: number = 0;\n\n constructor(style: Partial<Style>, options: GridOptions) {\n super({ flexDirection: 'column', ...style });\n this._columns = Math.max(1, options.columns);\n const gap = options.gap ?? 1;\n this._colGap = options.colGap ?? gap;\n this._rowGap = options.rowGap ?? gap;\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Grid is a pure layout container — no self-rendering needed.\n }\n\n /**\n * Add a widget to the grid. Items fill left-to-right,\n * wrapping to a new row automatically every `columns` items.\n * Overrides Widget.addChild so the reconciler generic loop works unchanged.\n */\n override addChild(widget: Widget): void {\n const rowIndex = Math.floor(this._itemCount / this._columns);\n\n // Create a new row Box if needed\n if (rowIndex >= this._rows.length) {\n const rowStyle: Partial<Style> = { flexDirection: 'row' };\n if (this._colGap > 0) rowStyle.gap = this._colGap;\n // Add row gap as margin-top on rows after the first\n if (this._rows.length > 0 && this._rowGap > 0) {\n rowStyle.margin = this._rowGap;\n }\n const row = new Box(rowStyle);\n this._rows.push(row);\n // Register the row as a child of this widget\n super.addChild(row);\n }\n\n // Add item to the current row with equal flex growth\n const currentRow = this._rows[rowIndex];\n widget.setStyle({ flexGrow: 1 });\n currentRow.addChild(widget);\n this._itemCount++;\n }\n\n /** Add an item explicitly (alias for addChild) */\n addItem(widget: Widget): void {\n this.addChild(widget);\n }\n\n /** Remove all items and reset the grid */\n clearItems(): void {\n // Unmount and detach every row\n for (const row of this._rows) {\n row.unmount();\n row.parent = null;\n }\n this._children = [];\n this._rows = [];\n this._itemCount = 0;\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ScrollView widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type KeyEvent } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface ScrollViewOptions {\n /** Total height of content in rows */\n contentHeight?: number;\n /** Show scrollbar indicator on right edge */\n showScrollbar?: boolean;\n}\n\n/**\n * ScrollView — a height-bounded scrollable container.\n *\n * Children are rendered with a vertical offset applied (scrolling).\n * Responds to up/down arrow keys and Page Up/Page Down.\n */\nexport class ScrollView extends Widget {\n private _scrollOffset: number = 0;\n private _contentHeight: number;\n private _showScrollbar: boolean;\n\n constructor(style: Partial<Style> = {}, opts: ScrollViewOptions = {}) {\n super({ overflow: 'hidden', ...style });\n this._contentHeight = opts.contentHeight ?? 0;\n this._showScrollbar = opts.showScrollbar ?? true;\n this.focusable = true;\n }\n\n /** Set the total content height (in rows) */\n setContentHeight(h: number): void {\n this._contentHeight = h;\n this._clampOffset();\n this.markDirty();\n }\n\n /** Get current scroll offset */\n get scrollOffset(): number { return this._scrollOffset; }\n\n /** Scroll by delta rows */\n scrollBy(delta: number): void {\n this._scrollOffset += delta;\n this._clampOffset();\n this.markDirty();\n }\n\n /** Scroll to absolute offset */\n scrollTo(offset: number): void {\n this._scrollOffset = offset;\n this._clampOffset();\n this.markDirty();\n }\n\n private _clampOffset(): void {\n const viewHeight = this._rect.height;\n const maxOffset = Math.max(0, this._contentHeight - viewHeight);\n this._scrollOffset = Math.max(0, Math.min(this._scrollOffset, maxOffset));\n }\n\n /** Handle keyboard navigation */\n onKey(event: KeyEvent): void {\n switch (event.key) {\n case 'ArrowUp': this.scrollBy(-1); break;\n case 'ArrowDown': this.scrollBy(1); break;\n case 'PageUp': this.scrollBy(-Math.max(1, this._rect.height - 1)); break;\n case 'PageDown': this.scrollBy(Math.max(1, this._rect.height - 1)); break;\n }\n }\n\n override render(screen: Screen): void {\n if (this._style.visible === false) return;\n\n const shouldClip = true;\n if (shouldClip) screen.pushClip(this._rect);\n\n this._renderSelf(screen);\n this._renderBorder(screen);\n\n // Temporarily shift children's rects upward by scrollOffset\n const rect = this._getContentRect();\n for (const child of this._children) {\n const origRect = { ...child.rect };\n (child as any)._rect = {\n x: origRect.x,\n y: origRect.y - this._scrollOffset,\n width: origRect.width,\n height: origRect.height,\n };\n try {\n child.render(screen);\n } finally {\n (child as any)._rect = origRect;\n }\n }\n\n if (shouldClip) screen.popClip();\n\n // Draw scrollbar on top (outside clip)\n if (this._showScrollbar && this._contentHeight > this._rect.height) {\n this._renderScrollbar(screen, rect);\n }\n }\n\n private _renderScrollbar(screen: Screen, contentRect: { x: number; y: number; width: number; height: number }): void {\n const { y, width, height } = contentRect;\n const scrollX = contentRect.x + width; // right edge of content\n if (scrollX >= this._rect.x + this._rect.width) return;\n\n const trackHeight = height;\n const thumbSize = Math.max(1, Math.round((height / this._contentHeight) * trackHeight));\n const maxOffset = Math.max(1, this._contentHeight - height);\n const thumbPos = Math.round((this._scrollOffset / maxOffset) * (trackHeight - thumbSize));\n\n const attrs = styleToCellAttrs(this._style);\n const thumbChar = '█';\n const trackChar = '░';\n\n for (let i = 0; i < trackHeight; i++) {\n const isThumb = i >= thumbPos && i < thumbPos + thumbSize;\n screen.setCell(scrollX, y + i, {\n char: isThumb ? thumbChar : trackChar,\n ...attrs,\n dim: !isThumb,\n });\n }\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Container only\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Center widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface CenterOptions {\n /** Center horizontally (default: true) */\n horizontal?: boolean;\n /** Center vertically (default: true) */\n vertical?: boolean;\n}\n\n/**\n * Center — centers a single child widget horizontally and/or vertically.\n *\n * Computes centering offsets at render time from the child's measured size.\n */\nexport class Center extends Widget {\n private _horizontal: boolean;\n private _vertical: boolean;\n\n constructor(style: Partial<Style> = {}, opts: CenterOptions = {}) {\n super(style);\n this._horizontal = opts.horizontal ?? true;\n this._vertical = opts.vertical ?? true;\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Pure layout container — no self-rendering\n }\n\n override render(screen: Screen): void {\n if (this._style.visible === false) return;\n\n const shouldClip = this._style.overflow !== 'visible';\n if (shouldClip) screen.pushClip(this._rect);\n\n this._renderSelf(screen);\n this._renderBorder(screen);\n\n const content = this._getContentRect();\n\n for (const child of this._children) {\n const childRect = child.rect;\n const origRect = { ...childRect };\n\n let offsetX = content.x;\n let offsetY = content.y;\n\n if (this._horizontal) {\n offsetX = content.x + Math.max(0, Math.floor((content.width - childRect.width) / 2));\n }\n if (this._vertical) {\n offsetY = content.y + Math.max(0, Math.floor((content.height - childRect.height) / 2));\n }\n\n (child as any)._rect = {\n x: offsetX,\n y: offsetY,\n width: childRect.width,\n height: childRect.height,\n };\n child.render(screen);\n (child as any)._rect = origRect;\n }\n\n if (shouldClip) screen.popClip();\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Card widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface CardOptions {\n /** Optional title shown in the top border */\n title?: string;\n /** Color for the border and title */\n borderColor?: Color;\n}\n\n/**\n * Card — a bordered container with an optional title in the top border.\n *\n * Like a Box with border + padding, but supports embedding a title string\n * directly in the top border line.\n */\nexport class Card extends Widget {\n private _title: string;\n private _borderColor?: Color;\n\n constructor(style: Partial<Style> = {}, opts: CardOptions = {}) {\n super({\n border: 'single',\n padding: 1,\n ...style,\n });\n this._title = opts.title ?? '';\n this._borderColor = opts.borderColor;\n }\n\n setTitle(title: string): void {\n this._title = title;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n if (!this._title) return;\n\n const { x, y, width } = this._rect;\n if (width < 4) return;\n\n const attrs = styleToCellAttrs(this._style);\n const fg = this._borderColor ?? attrs.fg;\n\n // Title rendered into top border: ─ Title ─\n const titleText = ` ${this._title} `;\n const titleWidth = stringWidth(titleText);\n const innerWidth = width - 2; // minus corners\n if (titleWidth > innerWidth) return;\n\n const titleX = x + 1 + Math.floor((innerWidth - titleWidth) / 2);\n screen.writeString(titleX, y, titleText, { fg, bold: true });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Columns widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { Box } from '../display/Box.js';\n\nexport interface ColumnsOptions {\n /** Gap between columns in cells (default: 1) */\n gap?: number;\n}\n\n/**\n * Columns — splits available width evenly across child widgets.\n *\n * Children are laid out side-by-side with equal flex-grow.\n * Internally uses a flex-row Box; the addChild override applies\n * flexGrow:1 to each child so the reconciler's generic loop works.\n */\nexport class Columns extends Widget {\n private _inner: Box;\n\n constructor(style: Partial<Style> = {}, opts: ColumnsOptions = {}) {\n super(style);\n this._inner = new Box({\n flexDirection: 'row',\n gap: opts.gap ?? 1,\n width: '100%',\n height: '100%',\n });\n super.addChild(this._inner);\n }\n\n override addChild(widget: Widget): void {\n widget.setStyle({ flexGrow: 1 });\n this._inner.addChild(widget);\n }\n\n override removeChild(widget: Widget): void {\n this._inner.removeChild(widget);\n }\n\n override clearChildren(): void {\n this._inner.clearChildren();\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Pure layout container\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ProgressBar widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type Color, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface ProgressBarOptions {\n /** Current value (0–1) */\n value?: number;\n /** Character for the filled portion */\n fillChar?: string;\n /** Character for the empty portion */\n emptyChar?: string;\n /** Color of the filled portion */\n fillColor?: Color;\n /** Show percentage label */\n showLabel?: boolean;\n /** Label format: 'percent' | 'fraction' | 'custom' */\n labelFormat?: 'percent' | 'fraction';\n /** Total for fraction display */\n total?: number;\n}\n\n/**\n * ProgressBar — horizontal progress indicator.\n *\n * Supports:\n * - Configurable fill/empty characters\n * - Custom fill color\n * - Percentage or fraction label\n * - Smooth animation-ready value changes\n */\nexport class ProgressBar extends Widget {\n private _value: number;\n private _fillChar: string;\n private _emptyChar: string;\n private _fillColor: Color;\n private _showLabel: boolean;\n private _labelFormat: 'percent' | 'fraction';\n private _total: number;\n\n constructor(style: Partial<Style> = {}, options: ProgressBarOptions = {}) {\n super({ height: 1, ...style });\n this._value = Math.max(0, Math.min(1, options.value ?? 0));\n this._fillChar = options.fillChar ?? (caps.unicode ? '█' : '#');\n this._emptyChar = options.emptyChar ?? (caps.unicode ? '░' : '-');\n this._fillColor = options.fillColor ?? { type: 'named', name: 'green' };\n this._showLabel = options.showLabel ?? true;\n this._labelFormat = options.labelFormat ?? 'percent';\n this._total = options.total ?? 100;\n }\n\n /** Set progress value (0–1) */\n setValue(value: number): void {\n this._value = Math.max(0, Math.min(1, value));\n this.markDirty();\n }\n\n get value(): number { return this._value; }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Label\n let label = '';\n if (this._showLabel) {\n if (this._labelFormat === 'percent') {\n label = ` ${Math.round(this._value * 100)}%`;\n } else {\n label = ` ${Math.round(this._value * this._total)}/${this._total}`;\n }\n }\n\n const barWidth = Math.max(0, width - label.length);\n const filled = Math.round(barWidth * this._value);\n const empty = barWidth - filled;\n\n // Render bar\n for (let i = 0; i < filled; i++) {\n screen.setCell(x + i, y, { char: this._fillChar, ...attrs, fg: this._fillColor });\n }\n for (let i = 0; i < empty; i++) {\n screen.setCell(x + filled + i, y, { char: this._emptyChar, ...attrs, dim: true });\n }\n\n // Render label\n if (label) {\n screen.writeString(x + barWidth, y, label, { ...attrs, bold: true });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — MultiProgress widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type Color, caps, BLOCK } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * A single progress item in MultiProgress\n */\nexport interface ProgressItem {\n label: string;\n value: number; // 0–1\n color?: Color; // optional fill color override\n}\n\n/**\n * Options for MultiProgress widget\n */\nexport interface MultiProgressOptions {\n items: ProgressItem[];\n labelWidth?: number; // chars reserved for label column, default: 12\n showValues?: boolean; // show percentage after bar, default: true\n}\n\n/**\n * MultiProgress — stacks multiple labeled progress bars in a vertical list.\n *\n * Each item renders on its own row with a label, bar, and optional percentage.\n *\n * Supports:\n * - Multiple items with individual colors\n * - Custom label column width\n * - Optional percentage display\n * - Smooth animation-ready value changes\n */\nexport class MultiProgress extends Widget {\n private _items: ProgressItem[];\n private _labelWidth: number;\n private _showValues: boolean;\n\n constructor(options: MultiProgressOptions, style: Partial<Style> = {}) {\n const height = options.items.length;\n super({ height, ...style });\n this._items = options.items.map(item => ({\n ...item,\n value: Math.max(0, Math.min(1, item.value)),\n }));\n this._labelWidth = options.labelWidth ?? 12;\n this._showValues = options.showValues ?? true;\n }\n\n /**\n * Replace all items and mark dirty\n */\n setItems(items: ProgressItem[]): void {\n this._items = items.map(item => ({\n ...item,\n value: Math.max(0, Math.min(1, item.value)),\n }));\n this.markDirty();\n }\n\n /**\n * Update a single item's value\n */\n updateItem(index: number, value: number): void {\n if (index >= 0 && index < this._items.length) {\n this._items[index].value = Math.max(0, Math.min(1, value));\n this.markDirty();\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Determine bar characters (unicode or ASCII fallback)\n const fillChar = caps.unicode ? '█' : BLOCK.full; // '█' or '#'\n const emptyChar = caps.unicode ? '░' : BLOCK.empty; // '░' or ' '\n\n // Render each item on its own row\n for (let i = 0; i < this._items.length; i++) {\n const item = this._items[i];\n const rowY = y + i;\n let colX = x;\n\n // 1. Render label (left-aligned, truncated/padded to labelWidth)\n const label = item.label.length > this._labelWidth\n ? item.label.substring(0, this._labelWidth)\n : item.label.padEnd(this._labelWidth);\n screen.writeString(colX, rowY, label, attrs);\n colX += this._labelWidth;\n\n // 2. Space after label\n if (colX < x + width) {\n screen.setCell(colX, rowY, { char: ' ', ...attrs });\n colX++;\n }\n\n // 3. Calculate bar width (accounting for percentage label if shown)\n let percentLabel = '';\n if (this._showValues) {\n percentLabel = ` ${Math.round(item.value * 100)}%`;\n }\n const barWidth = Math.max(0, x + width - colX - percentLabel.length);\n const filled = Math.round(barWidth * item.value);\n const empty = barWidth - filled;\n\n // 4. Render filled portion\n const fillColor = item.color ?? { type: 'named', name: 'green' };\n for (let j = 0; j < filled; j++) {\n screen.setCell(colX + j, rowY, { char: fillChar, ...attrs, fg: fillColor });\n }\n\n // 5. Render empty portion\n for (let j = 0; j < empty; j++) {\n screen.setCell(colX + filled + j, rowY, { char: emptyChar, ...attrs, dim: true });\n }\n\n // 6. Render percentage label if enabled\n if (percentLabel) {\n const labelX = colX + barWidth;\n screen.writeString(labelX, rowY, percentLabel, { ...attrs, bold: true });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Spinner widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type Color, caps, BRAILLE_SPIN } from '@termuijs/core';\nimport { timerPoolSubscribe } from '@termuijs/motion';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * Built-in spinner frame sets.\n */\nexport const SPINNER_FRAMES: Record<string, { frames: string[]; interval: number }> = {\n dots: {\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n interval: 80,\n },\n line: {\n frames: ['-', '\\\\', '|', '/'],\n interval: 130,\n },\n star: {\n frames: ['✶', '✸', '✹', '✺', '✹', '✷'],\n interval: 70,\n },\n arc: {\n frames: ['◜', '◠', '◝', '◞', '◡', '◟'],\n interval: 100,\n },\n circle: {\n frames: ['◐', '◓', '◑', '◒'],\n interval: 120,\n },\n bounce: {\n frames: ['⠁', '⠂', '⠄', '⠂'],\n interval: 120,\n },\n arrow: {\n frames: ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'],\n interval: 100,\n },\n clock: {\n frames: ['🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙', '🕚', '🕛'],\n interval: 100,\n },\n};\n\nexport interface SpinnerOptions {\n /** Spinner preset name or custom frames */\n spinner?: string | { frames: string[]; interval: number };\n /** Text label displayed after the spinner */\n label?: string;\n /** Color for the spinner frames */\n color?: Color;\n}\n\n/**\n * Spinner — animated loading indicator.\n *\n * Supports:\n * - 8 built-in spinner presets\n * - Custom frame sequences\n * - Configurable color and label\n * - Automatic frame advancement via tick()\n */\nexport class Spinner extends Widget {\n private _frames: string[];\n private _interval: number;\n private _frameIndex = 0;\n private _label: string;\n private _color: Color;\n private _lastTick = 0;\n private _elapsed = 0;\n private _timerUnsub?: () => void;\n\n constructor(style: Partial<Style> = {}, options: SpinnerOptions = {}) {\n super({ height: 1, ...style });\n\n const spinnerDef = typeof options.spinner === 'string'\n ? (SPINNER_FRAMES[options.spinner] ?? SPINNER_FRAMES.dots)\n : (options.spinner ?? SPINNER_FRAMES.dots);\n\n this._frames = spinnerDef.frames;\n this._interval = spinnerDef.interval;\n this._label = options.label ?? '';\n this._color = options.color ?? { type: 'named', name: 'cyan' };\n\n if (!caps.unicode && this._frames.some(f => f.codePointAt(0)! > 127)) {\n this._frames = Array.from(BRAILLE_SPIN);\n this._interval = 130; // match 'line' spinner speed\n }\n }\n\n /** Update the spinner label */\n setLabel(label: string): void {\n this._label = label;\n }\n\n /**\n * Advance the spinner frame based on elapsed time.\n * Call this with a delta (ms) from the render loop.\n */\n tick(deltaMs: number): void {\n if (!caps.motion) return;\n\n this._elapsed += deltaMs;\n if (this._elapsed >= this._interval) {\n this._frameIndex = (this._frameIndex + 1) % this._frames.length;\n this._elapsed = 0;\n }\n }\n\n /** Lifecycle: start the frame-advance timer (only when motion is enabled). */\n mount(): void {\n super.mount();\n if (!caps.motion) return;\n this._timerUnsub = timerPoolSubscribe(this._interval, () => {\n this._frameIndex = (this._frameIndex + 1) % this._frames.length;\n this.markDirty();\n });\n }\n\n /** Lifecycle: stop the frame-advance timer. */\n unmount(): void {\n this._timerUnsub?.();\n this._timerUnsub = undefined;\n super.unmount();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const frame = this._frames[this._frameIndex];\n\n // Render spinner character\n screen.writeString(x, y, frame, { ...attrs, fg: this._color });\n\n // Render label\n if (this._label) {\n screen.writeString(x + 2, y, this._label, attrs);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Scrollbar widget\n// Proportional scrollbar with 4 orientation modes.\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen, type Style, type Color,\n ScrollbarSets,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n// ── Types ────────────────────────────────────────────\n\nexport type ScrollbarOrientation =\n | 'verticalRight'\n | 'verticalLeft'\n | 'horizontalBottom'\n | 'horizontalTop';\n\nexport interface ScrollbarOptions {\n /** Total number of content items. */\n contentLength: number;\n /** Number of items visible in the viewport. */\n viewportLength: number;\n /** Current scroll position (0-based). */\n position?: number;\n /** Scrollbar orientation. Default: 'verticalRight'. */\n orientation?: ScrollbarOrientation;\n /** Color of the thumb. */\n thumbColor?: Color;\n /** Color of the track. */\n trackColor?: Color;\n /** Show begin/end arrow symbols. Default: true. */\n showArrows?: boolean;\n}\n\n// ── Widget ───────────────────────────────────────────\n\nexport class Scrollbar extends Widget {\n private _contentLength: number;\n private _viewportLength: number;\n private _position: number;\n private _orientation: ScrollbarOrientation;\n private _thumbColor: Color;\n private _trackColor: Color;\n private _showArrows: boolean;\n\n constructor(style: Partial<Style> = {}, opts: ScrollbarOptions) {\n super(style);\n this._contentLength = opts.contentLength;\n this._viewportLength = opts.viewportLength;\n this._position = opts.position ?? 0;\n this._orientation = opts.orientation ?? 'verticalRight';\n this._thumbColor = opts.thumbColor ?? { type: 'named', name: 'white' };\n this._trackColor = opts.trackColor ?? { type: 'named', name: 'brightBlack' };\n this._showArrows = opts.showArrows ?? true;\n }\n\n setPosition(position: number): void {\n this._position = position;\n this.markDirty();\n }\n\n setContentLength(length: number): void {\n this._contentLength = length;\n this.markDirty();\n }\n\n setViewportLength(length: number): void {\n this._viewportLength = length;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._contentLength <= 0) return;\n if (this._contentLength <= this._viewportLength) return;\n\n const vertical = this._orientation === 'verticalRight'\n || this._orientation === 'verticalLeft';\n\n const symbols = vertical\n ? ScrollbarSets.VERTICAL\n : ScrollbarSets.HORIZONTAL;\n\n // Determine track position\n const trackX = this._orientation === 'verticalLeft' ? x\n : this._orientation === 'verticalRight' ? x + width - 1\n : x;\n const trackY = this._orientation === 'horizontalTop' ? y\n : this._orientation === 'horizontalBottom' ? y + height - 1\n : y;\n\n const totalLength = vertical ? height : width;\n if (totalLength <= 0) return;\n\n let trackStart = 0;\n let trackLength = totalLength;\n\n // Draw arrow symbols\n if (this._showArrows && totalLength > 2) {\n const beginX = vertical ? trackX : x;\n const beginY = vertical ? y : trackY;\n screen.setCell(beginX, beginY, {\n char: symbols.begin,\n fg: this._trackColor,\n });\n\n const endX = vertical ? trackX : x + totalLength - 1;\n const endY = vertical ? y + totalLength - 1 : trackY;\n screen.setCell(endX, endY, {\n char: symbols.end,\n fg: this._trackColor,\n });\n\n trackStart = 1;\n trackLength -= 2;\n }\n\n if (trackLength <= 0) return;\n\n // Compute thumb size and position\n const thumbSize = Math.max(1, Math.floor(\n (trackLength * this._viewportLength) / this._contentLength\n ));\n const maxScroll = Math.max(1, this._contentLength - this._viewportLength);\n const thumbOffset = Math.min(\n trackLength - thumbSize,\n Math.floor((this._position * (trackLength - thumbSize)) / maxScroll),\n );\n\n // Draw track and thumb\n for (let i = 0; i < trackLength; i++) {\n const pos = trackStart + i;\n const cellX = vertical ? trackX : x + pos;\n const cellY = vertical ? y + pos : trackY;\n\n const isThumb = i >= thumbOffset && i < thumbOffset + thumbSize;\n\n screen.setCell(cellX, cellY, {\n char: isThumb ? symbols.thumb : symbols.track,\n fg: isThumb ? this._thumbColor : this._trackColor,\n });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Skeleton loading placeholder widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { timerPoolSubscribe } from '@termuijs/motion';\n\nexport interface SkeletonOptions {\n /** Animation style: 'pulse' alternates two chars; 'shimmer' scrolls a highlight band */\n variant?: 'pulse' | 'shimmer';\n /** Animation interval in ms (default: 600) */\n intervalMs?: number;\n /** Characters for pulse: [dim, bright]. Default: ['░', '▒'] (ASCII fallback: ['-', '#']) */\n chars?: [string, string];\n /** Color for the bright state (optional) */\n color?: Color;\n}\n\n/**\n * Skeleton — animated loading placeholder.\n *\n * Supports:\n * - 'pulse' variant: alternates between dim and bright fill characters\n * - 'shimmer' variant: scrolls a bright band (~20% width) across the widget\n * - Automatic ASCII fallback when unicode is unavailable\n * - No animation when caps.motion is false (static frame 0)\n */\nexport class Skeleton extends Widget {\n private _frame: number = 0;\n private _shimmerPos: number = 0;\n private _unsub?: () => void;\n private _chars: [string, string];\n private _variant: 'pulse' | 'shimmer';\n private _intervalMs: number;\n\n constructor(style: Partial<Style> = {}, options: SkeletonOptions = {}) {\n super(style);\n this._variant = options.variant ?? 'pulse';\n this._intervalMs = options.intervalMs ?? 600;\n\n // ASCII fallback when unicode not available\n const defaultChars: [string, string] = caps.unicode\n ? ['░', '▒']\n : ['-', '#'];\n this._chars = options.chars ?? defaultChars;\n\n // Only animate when motion is enabled\n if (caps.motion) {\n this._unsub = timerPoolSubscribe(this._intervalMs, () => {\n this._frame = 1 - this._frame;\n if (this._variant === 'shimmer') {\n this._shimmerPos++;\n }\n this.markDirty();\n });\n }\n }\n\n override unmount(): void {\n this._unsub?.();\n this._unsub = undefined;\n super.unmount();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n if (this._variant === 'pulse') {\n const char = this._chars[this._frame];\n const dim = this._frame === 0;\n for (let row = y; row < y + height; row++) {\n for (let col = x; col < x + width; col++) {\n screen.setCell(col, row, { char, dim, bold: false });\n }\n }\n } else {\n // Shimmer: moving band of bright char, rest dim\n const bandWidth = Math.max(1, Math.floor(width * 0.2));\n const totalPositions = width + bandWidth;\n const bandStart = this._shimmerPos % totalPositions;\n\n for (let row = y; row < y + height; row++) {\n for (let colOffset = 0; colOffset < width; colOffset++) {\n const col = x + colOffset;\n const inBand = colOffset >= bandStart && colOffset < bandStart + bandWidth;\n const char = inBand ? this._chars[1] : this._chars[0];\n screen.setCell(col, row, { char, dim: !inBand, bold: false });\n }\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — StatusMessage widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type StatusVariant = 'success' | 'error' | 'warning' | 'info';\n\nexport interface StatusMessageOptions {\n /** Variant determines icon and color */\n variant?: StatusVariant;\n /** Override the icon character */\n icon?: string;\n}\n\n// Icons: unicode and ASCII fallbacks\nconst ICONS_UNICODE: Record<StatusVariant, string> = {\n success: '✓',\n error: '✗',\n warning: '⚠',\n info: 'ℹ',\n};\n\nconst ICONS_ASCII: Record<StatusVariant, string> = {\n success: '+',\n error: 'x',\n warning: '!',\n info: 'i',\n};\n\nconst COLORS: Record<StatusVariant, Color> = {\n success: { type: 'named', name: 'green' },\n error: { type: 'named', name: 'red' },\n warning: { type: 'named', name: 'yellow' },\n info: { type: 'named', name: 'cyan' },\n};\n\n/**\n * StatusMessage — a single-line status indicator.\n *\n * Renders an icon (✓/✗/⚠/ℹ) followed by a message, colored by variant.\n */\nexport class StatusMessage extends Widget {\n private _message: string;\n private _variant: StatusVariant;\n private _icon?: string;\n\n constructor(message: string, style: Partial<Style> = {}, opts: StatusMessageOptions = {}) {\n super({ height: 1, ...style });\n this._message = message;\n this._variant = opts.variant ?? 'info';\n this._icon = opts.icon;\n }\n\n setMessage(message: string): void {\n this._message = message;\n this.markDirty();\n }\n\n setVariant(variant: StatusVariant): void {\n this._variant = variant;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const color = COLORS[this._variant];\n const iconMap = caps.unicode ? ICONS_UNICODE : ICONS_ASCII;\n const icon = this._icon ?? iconMap[this._variant];\n\n // Render icon in variant color\n screen.writeString(x, y, icon, { ...attrs, fg: color, bold: true });\n\n // Space + message\n const msgX = x + icon.length + 1;\n const remaining = width - icon.length - 1;\n if (remaining > 0) {\n screen.writeString(msgX, y, this._message.slice(0, remaining), { ...attrs, fg: color });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Banner widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, getBorderChars } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { type StatusVariant } from './StatusMessage.js';\n\nexport interface BannerOptions {\n /** Variant determines border color */\n variant?: StatusVariant;\n /** Title displayed on first line in bold */\n title?: string;\n /** Body text */\n body?: string;\n}\n\nconst VARIANT_COLORS: Record<StatusVariant, Color> = {\n success: { type: 'named', name: 'green' },\n error: { type: 'named', name: 'red' },\n warning: { type: 'named', name: 'yellow' },\n info: { type: 'named', name: 'cyan' },\n};\n\n/**\n * Banner — full-width alert with title and body text.\n *\n * Shows a bordered box with a bold title line and body text,\n * colored according to variant. The border is drawn manually\n * to use the variant color.\n */\nexport class Banner extends Widget {\n private _variant: StatusVariant;\n private _title: string;\n private _body: string;\n\n constructor(style: Partial<Style> = {}, opts: BannerOptions = {}) {\n // Do NOT set border in style — we render it manually for color control\n super({\n width: '100%',\n padding: 1,\n ...style,\n });\n this._variant = opts.variant ?? 'info';\n this._title = opts.title ?? '';\n this._body = opts.body ?? '';\n }\n\n setTitle(title: string): void {\n this._title = title;\n this.markDirty();\n }\n\n setBody(body: string): void {\n this._body = body;\n this.markDirty();\n }\n\n setVariant(variant: StatusVariant): void {\n this._variant = variant;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width < 2 || height < 2) return;\n\n const attrs = styleToCellAttrs(this._style);\n const color = VARIANT_COLORS[this._variant];\n const fg = color;\n\n // Draw border manually in variant color\n const borderChars = getBorderChars('single');\n if (borderChars) {\n // Top edge\n screen.setCell(x, y, { char: borderChars.topLeft, fg });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y, { char: borderChars.top, fg });\n }\n screen.setCell(x + width - 1, y, { char: borderChars.topRight, fg });\n\n // Bottom edge\n screen.setCell(x, y + height - 1, { char: borderChars.bottomLeft, fg });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y + height - 1, { char: borderChars.bottom, fg });\n }\n screen.setCell(x + width - 1, y + height - 1, { char: borderChars.bottomRight, fg });\n\n // Left and right edges\n for (let r = 1; r < height - 1; r++) {\n screen.setCell(x, y + r, { char: borderChars.left, fg });\n screen.setCell(x + width - 1, y + r, { char: borderChars.right, fg });\n }\n }\n\n // Content area (inside border + padding=1)\n const cx = x + 2; // border(1) + padding(1)\n const cy = y + 2;\n const contentWidth = Math.max(0, width - 4); // left/right border+padding\n const contentHeight = Math.max(0, height - 4); // top/bottom border+padding\n\n let row = 0;\n\n // Title (bold)\n if (this._title && row < contentHeight) {\n screen.writeString(cx, cy + row, this._title.slice(0, contentWidth), {\n ...attrs,\n fg: color,\n bold: true,\n });\n row++;\n }\n\n // Body text\n if (this._body) {\n const lines = this._body.split('\\n');\n for (const line of lines) {\n if (row >= contentHeight) break;\n screen.writeString(cx, cy + row, line.slice(0, contentWidth), {\n ...attrs,\n fg: color,\n });\n row++;\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — KeyValue widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface KeyValuePair {\n key: string;\n value: string;\n}\n\nexport interface KeyValueOptions {\n /** Separator between key and value (default: ': ') */\n separator?: string;\n /** Color for keys */\n keyColor?: import('@termuijs/core').Color;\n /** Color for values */\n valueColor?: import('@termuijs/core').Color;\n}\n\n/**\n * KeyValue — aligned key: value pairs.\n *\n * Keys are right-aligned to the width of the longest key.\n * Values follow after the separator.\n */\nexport class KeyValue extends Widget {\n private _pairs: KeyValuePair[];\n private _separator: string;\n private _keyColor?: import('@termuijs/core').Color;\n private _valueColor?: import('@termuijs/core').Color;\n\n constructor(\n pairs: Array<KeyValuePair> | Record<string, string>,\n style: Partial<Style> = {},\n opts: KeyValueOptions = {},\n ) {\n super(style);\n this._pairs = Array.isArray(pairs)\n ? pairs\n : Object.entries(pairs).map(([key, value]) => ({ key, value }));\n this._separator = opts.separator ?? ': ';\n this._keyColor = opts.keyColor;\n this._valueColor = opts.valueColor;\n }\n\n setPairs(pairs: Array<KeyValuePair> | Record<string, string>): void {\n this._pairs = Array.isArray(pairs)\n ? pairs\n : Object.entries(pairs).map(([key, value]) => ({ key, value }));\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._pairs.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Find max key width for alignment\n let maxKeyWidth = 0;\n for (const pair of this._pairs) {\n const w = stringWidth(pair.key);\n if (w > maxKeyWidth) maxKeyWidth = w;\n }\n\n const sepWidth = stringWidth(this._separator);\n\n for (let i = 0; i < this._pairs.length && i < height; i++) {\n const pair = this._pairs[i];\n if (!pair) continue;\n\n const keyWidth = stringWidth(pair.key);\n const keyX = x + (maxKeyWidth - keyWidth); // right-align key\n const sepX = x + maxKeyWidth;\n const valX = sepX + sepWidth;\n const valWidth = Math.max(0, width - maxKeyWidth - sepWidth);\n\n // Key\n screen.writeString(keyX, y + i, pair.key, {\n ...attrs,\n fg: this._keyColor ?? attrs.fg,\n bold: true,\n });\n\n // Separator\n screen.writeString(sepX, y + i, this._separator, { ...attrs, dim: true });\n\n // Value\n if (valWidth > 0) {\n screen.writeString(valX, y + i, pair.value.slice(0, valWidth), {\n ...attrs,\n fg: this._valueColor ?? attrs.fg,\n });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Sidebar widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface SidebarItem {\n label: string;\n badge?: string;\n active?: boolean;\n}\n\nexport interface SidebarOptions {\n /** Whether the sidebar is collapsed */\n collapsed?: boolean;\n /** Collapsed width in cells (default: 3) */\n collapsedWidth?: number;\n /** Active item highlight color */\n activeColor?: import('@termuijs/core').Color;\n /** Badge color */\n badgeColor?: import('@termuijs/core').Color;\n}\n\n/**\n * Sidebar — a vertical list of navigation items with optional badges.\n *\n * Supports active item highlighting and collapsible mode.\n */\nexport class Sidebar extends Widget {\n private _items: SidebarItem[];\n private _collapsed: boolean;\n private _collapsedWidth: number;\n private _activeColor: import('@termuijs/core').Color;\n private _badgeColor: import('@termuijs/core').Color;\n\n constructor(items: SidebarItem[], style: Partial<Style> = {}, opts: SidebarOptions = {}) {\n super(style);\n this._items = items;\n this._collapsed = opts.collapsed ?? false;\n this._collapsedWidth = opts.collapsedWidth ?? 3;\n this._activeColor = opts.activeColor ?? { type: 'named', name: 'cyan' };\n this._badgeColor = opts.badgeColor ?? { type: 'named', name: 'yellow' };\n }\n\n setItems(items: SidebarItem[]): void {\n this._items = items;\n this.markDirty();\n }\n\n setCollapsed(collapsed: boolean): void {\n this._collapsed = collapsed;\n this.markDirty();\n }\n\n toggle(): void {\n this._collapsed = !this._collapsed;\n this.markDirty();\n }\n\n get isCollapsed(): boolean { return this._collapsed; }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n for (let i = 0; i < this._items.length && i < height; i++) {\n const item = this._items[i];\n if (!item) continue;\n\n const isActive = item.active ?? false;\n const fg = isActive ? this._activeColor : attrs.fg;\n\n if (this._collapsed) {\n // Collapsed: show first character of label only\n const char = item.label.charAt(0) || ' ';\n screen.writeString(x, y + i, char, { ...attrs, fg, bold: isActive });\n } else {\n // Active indicator\n const prefix = isActive ? '▶ ' : ' ';\n const prefixWidth = stringWidth(prefix);\n\n screen.writeString(x, y + i, prefix, { ...attrs, fg });\n\n // Label\n const badgeText = item.badge ? ` [${item.badge}]` : '';\n const badgeWidth = stringWidth(badgeText);\n const labelWidth = Math.max(0, width - prefixWidth - badgeWidth);\n const label = item.label.slice(0, labelWidth);\n\n screen.writeString(x + prefixWidth, y + i, label, {\n ...attrs,\n fg,\n bold: isActive,\n });\n\n // Badge\n if (item.badge && badgeWidth > 0) {\n const badgeX = x + width - badgeWidth;\n screen.writeString(badgeX, y + i, badgeText, {\n ...attrs,\n fg: this._badgeColor,\n });\n }\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — LineChart widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface LineChartOptions {\n /** Color of the plotted points/lines */\n color?: Color;\n /** Show Y-axis labels */\n showYAxis?: boolean;\n /** Show X-axis labels */\n showXAxis?: boolean;\n /** Label for the Y axis */\n yLabel?: string;\n /** Maximum Y value (auto if not set) */\n max?: number;\n /** Minimum Y value (auto if not set) */\n min?: number;\n}\n\n// Unicode point character; ASCII fallback\nconst POINT_CHAR_UNICODE = '●';\nconst POINT_CHAR_ASCII = '*';\n\n/**\n * LineChart — ASCII/Unicode line plot for a series of numbers.\n *\n * Normalizes data to the available height, samples to fit width.\n * Plots points with simple vertical bar connectors between adjacent points.\n */\nexport class LineChart extends Widget {\n private _data: number[];\n private _color: Color;\n private _showYAxis: boolean;\n private _showXAxis: boolean;\n private _yLabel: string;\n private _max?: number;\n private _min?: number;\n\n constructor(data: number[], style: Partial<Style> = {}, opts: LineChartOptions = {}) {\n super(style);\n this._data = data;\n this._color = opts.color ?? { type: 'named', name: 'cyan' };\n this._showYAxis = opts.showYAxis ?? false;\n this._showXAxis = opts.showXAxis ?? false;\n this._yLabel = opts.yLabel ?? '';\n this._max = opts.max;\n this._min = opts.min;\n }\n\n setData(data: number[]): void {\n this._data = data;\n this.markDirty();\n }\n\n pushValue(value: number): void {\n this._data.push(value);\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n let { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._data.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Reserve rows for X axis\n const plotHeight = this._showXAxis ? Math.max(1, height - 1) : height;\n // Reserve cols for Y axis\n const yAxisWidth = this._showYAxis ? 5 : 0;\n const plotWidth = Math.max(1, width - yAxisWidth);\n const plotX = x + yAxisWidth;\n\n // Compute range\n const min = this._min ?? Math.min(...this._data);\n const max = this._max ?? Math.max(...this._data);\n const range = max - min || 1;\n\n // Sample data to fit plotWidth\n const samples: number[] = [];\n for (let col = 0; col < plotWidth; col++) {\n const idx = Math.floor((col / plotWidth) * this._data.length);\n const val = this._data[Math.min(idx, this._data.length - 1)];\n samples.push(val ?? min);\n }\n\n // Map value to row (row 0 = top = max)\n const toRow = (v: number): number => {\n const norm = (v - min) / range;\n return Math.max(0, Math.min(plotHeight - 1, Math.round((1 - norm) * (plotHeight - 1))));\n };\n\n // Render Y axis\n if (this._showYAxis && yAxisWidth > 0) {\n for (let row = 0; row < plotHeight; row++) {\n const v = plotHeight > 1 ? max - (row / (plotHeight - 1)) * range : max;\n if (row === 0 || row === plotHeight - 1) {\n const label = v.toFixed(0).padStart(yAxisWidth - 1, ' ');\n screen.writeString(x, y + row, label + '┤', { ...attrs, dim: true });\n } else {\n screen.writeString(x + yAxisWidth - 1, y + row, '│', { ...attrs, dim: true });\n }\n }\n }\n\n // Render points and connectors\n const pointChar = caps.unicode ? POINT_CHAR_UNICODE : POINT_CHAR_ASCII;\n\n let prevRow: number | null = null;\n for (let col = 0; col < samples.length; col++) {\n const val = samples[col];\n if (val === undefined) continue;\n const row = toRow(val);\n\n // Draw vertical connector from prev point to current\n if (prevRow !== null && Math.abs(row - prevRow) > 1) {\n const top = Math.min(prevRow, row) + 1;\n const bottom = Math.max(prevRow, row);\n for (let r = top; r < bottom; r++) {\n screen.setCell(plotX + col, y + r, { char: '│', fg: this._color, dim: true });\n }\n }\n\n // Draw point\n screen.setCell(plotX + col, y + row, { char: pointChar, fg: this._color });\n\n prevRow = row;\n }\n\n // X axis\n if (this._showXAxis) {\n const axisY = y + height - 1;\n for (let col = 0; col < plotWidth; col++) {\n screen.setCell(plotX + col, axisY, { char: '─', ...attrs, dim: true });\n }\n if (yAxisWidth > 0) {\n screen.setCell(plotX - 1, axisY, { char: '└', ...attrs, dim: true });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — HeatMap widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface HeatMapOptions {\n /** Color for maximum value cells */\n highColor?: Color;\n /** Color for minimum value cells */\n lowColor?: Color;\n /** Row labels (left side) */\n rowLabels?: string[];\n /** Column labels (top) */\n colLabels?: string[];\n}\n\n// Shading characters from sparse to dense\nconst SHADE_CHARS_UNICODE = ['░', '▒', '▓', '█'];\nconst SHADE_CHARS_ASCII = ['.', ':', '+', '#'];\n\n/**\n * HeatMap — 2D matrix displayed with character-density shading.\n *\n * Values are normalized 0–1 and mapped to 4 shading levels.\n */\nexport class HeatMap extends Widget {\n private _matrix: number[][];\n private _highColor: Color;\n private _lowColor: Color;\n private _rowLabels: string[];\n private _colLabels: string[];\n\n constructor(matrix: number[][], style: Partial<Style> = {}, opts: HeatMapOptions = {}) {\n super(style);\n this._matrix = matrix;\n this._highColor = opts.highColor ?? { type: 'named', name: 'red' };\n this._lowColor = opts.lowColor ?? { type: 'named', name: 'brightBlack' };\n this._rowLabels = opts.rowLabels ?? [];\n this._colLabels = opts.colLabels ?? [];\n }\n\n setMatrix(matrix: number[][]): void {\n this._matrix = matrix;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._matrix.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const shadeChars = caps.unicode ? SHADE_CHARS_UNICODE : SHADE_CHARS_ASCII;\n\n // Compute row label width\n const labelWidth = this._rowLabels.length > 0\n ? Math.max(...this._rowLabels.map(l => l.length)) + 1\n : 0;\n\n // Compute global min/max for normalization\n let globalMin = Infinity;\n let globalMax = -Infinity;\n for (const row of this._matrix) {\n for (const val of row) {\n if (val < globalMin) globalMin = val;\n if (val > globalMax) globalMax = val;\n }\n }\n const range = globalMax - globalMin || 1;\n\n // Column labels\n let startRow = 0;\n if (this._colLabels.length > 0) {\n for (let col = 0; col < this._colLabels.length; col++) {\n const cx = x + labelWidth + col;\n if (cx >= x + width) break;\n const label = (this._colLabels[col] ?? '').charAt(0);\n screen.setCell(cx, y, { char: label, ...attrs, dim: true });\n }\n startRow = 1;\n }\n\n // Render matrix rows\n for (let r = 0; r < this._matrix.length; r++) {\n const rowY = y + startRow + r;\n if (rowY >= y + height) break;\n\n // Row label\n if (this._rowLabels[r]) {\n const label = this._rowLabels[r].slice(0, labelWidth - 1).padEnd(labelWidth - 1, ' ');\n screen.writeString(x, rowY, label + ' ', { ...attrs, dim: true });\n }\n\n const row = this._matrix[r];\n if (!row) continue;\n\n for (let col = 0; col < row.length; col++) {\n const cx = x + labelWidth + col;\n if (cx >= x + width) break;\n\n const val = row[col] ?? 0;\n const norm = (val - globalMin) / range; // 0..1\n const level = Math.min(3, Math.floor(norm * 4));\n const char = shadeChars[level] ?? shadeChars[0]!;\n\n // Blend color: low → high based on norm\n // Use high color for dense cells\n const fg = norm >= 0.75 ? this._highColor : this._lowColor;\n\n screen.setCell(cx, rowY, { char, fg });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Definition widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface DefinitionPair {\n term: string;\n definition: string;\n}\n\nexport interface DefinitionOptions {\n /** Indentation for definition lines (default: 2) */\n indent?: number;\n /** Blank line between pairs (default: true) */\n spacing?: boolean;\n /** Color for term labels */\n termColor?: import('@termuijs/core').Color;\n /** Color for definition text */\n definitionColor?: import('@termuijs/core').Color;\n}\n\n/**\n * Definition — term + definition pairs, stacked vertically.\n *\n * Each pair renders as:\n * Term\n * definition text (indented)\n *\n * Similar to KeyValue but stacked rather than inline.\n */\nexport class Definition extends Widget {\n private _pairs: DefinitionPair[];\n private _indent: number;\n private _spacing: boolean;\n private _termColor?: import('@termuijs/core').Color;\n private _definitionColor?: import('@termuijs/core').Color;\n\n constructor(\n pairs: DefinitionPair[] | Record<string, string>,\n style: Partial<Style> = {},\n opts: DefinitionOptions = {},\n ) {\n super(style);\n this._pairs = Array.isArray(pairs)\n ? pairs\n : Object.entries(pairs).map(([term, definition]) => ({ term, definition }));\n this._indent = opts.indent ?? 2;\n this._spacing = opts.spacing ?? true;\n this._termColor = opts.termColor;\n this._definitionColor = opts.definitionColor;\n }\n\n setPairs(pairs: DefinitionPair[] | Record<string, string>): void {\n this._pairs = Array.isArray(pairs)\n ? pairs\n : Object.entries(pairs).map(([term, definition]) => ({ term, definition }));\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._pairs.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const indent = Math.min(this._indent, width - 1);\n\n let row = 0;\n\n for (const pair of this._pairs) {\n if (row >= height) break;\n\n // Term (bold)\n screen.writeString(x, y + row, pair.term.slice(0, width), {\n ...attrs,\n fg: this._termColor ?? attrs.fg,\n bold: true,\n });\n row++;\n\n if (row >= height) break;\n\n // Definition (indented, may span multiple lines via simple wrapping)\n const defWidth = Math.max(1, width - indent);\n const words = pair.definition.split(' ');\n let line = '';\n\n for (const word of words) {\n if (line.length === 0) {\n line = word;\n } else if (line.length + 1 + word.length <= defWidth) {\n line += ' ' + word;\n } else {\n if (row >= height) break;\n screen.writeString(x + indent, y + row, line, {\n ...attrs,\n fg: this._definitionColor ?? attrs.fg,\n });\n row++;\n line = word;\n }\n }\n\n if (line && row < height) {\n screen.writeString(x + indent, y + row, line, {\n ...attrs,\n fg: this._definitionColor ?? attrs.fg,\n });\n row++;\n }\n\n // Blank line between pairs\n if (this._spacing && row < height) {\n row++;\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — BigText widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface BigTextOptions {\n /** Color for the rendered characters */\n color?: Color;\n}\n\n// 5×3 ASCII art character map (5 rows × 3 cols per char)\n// Each character is represented as an array of 5 strings, each 3 chars wide.\nconst CHAR_MAP: Record<string, string[]> = {\n 'A': [' # ', '# #', '###', '# #', '# #'],\n 'B': ['## ', '# #', '## ', '# #', '## '],\n 'C': [' ##', '# ', '# ', '# ', ' ##'],\n 'D': ['## ', '# #', '# #', '# #', '## '],\n 'E': ['###', '# ', '## ', '# ', '###'],\n 'F': ['###', '# ', '## ', '# ', '# '],\n 'G': [' ##', '# ', '# #', '# #', ' ##'],\n 'H': ['# #', '# #', '###', '# #', '# #'],\n 'I': ['###', ' # ', ' # ', ' # ', '###'],\n 'J': ['###', ' #', ' #', '# #', ' # '],\n 'K': ['# #', '## ', '# ', '## ', '# #'],\n 'L': ['# ', '# ', '# ', '# ', '###'],\n 'M': ['# #', '###', '# #', '# #', '# #'],\n 'N': ['# #', '## ', '# #', '# #', '# #'],\n 'O': [' # ', '# #', '# #', '# #', ' # '],\n 'P': ['## ', '# #', '## ', '# ', '# '],\n 'Q': [' # ', '# #', '# #', '##:', ' ##'],\n 'R': ['## ', '# #', '## ', '## ', '# #'],\n 'S': [' ##', '# ', ' # ', ' #', '## '],\n 'T': ['###', ' # ', ' # ', ' # ', ' # '],\n 'U': ['# #', '# #', '# #', '# #', '###'],\n 'V': ['# #', '# #', '# #', '# #', ' # '],\n 'W': ['# #', '# #', '# #', '###', '# #'],\n 'X': ['# #', '# #', ' # ', '# #', '# #'],\n 'Y': ['# #', '# #', ' # ', ' # ', ' # '],\n 'Z': ['###', ' #', ' # ', '# ', '###'],\n '0': [' # ', '# #', '# #', '# #', ' # '],\n '1': [' # ', '## ', ' # ', ' # ', '###'],\n '2': [' # ', '# #', ' # ', '# ', '###'],\n '3': ['## ', ' #', ' ##', ' #', '## '],\n '4': ['# #', '# #', '###', ' #', ' #'],\n '5': ['###', '# ', '## ', ' #', '## '],\n '6': [' # ', '# ', '## ', '# #', ' # '],\n '7': ['###', ' #', ' # ', '# ', '# '],\n '8': [' # ', '# #', ' # ', '# #', ' # '],\n '9': [' # ', '# #', ' ##', ' #', ' # '],\n ' ': [' ', ' ', ' ', ' ', ' '],\n '!': [' # ', ' # ', ' # ', ' ', ' # '],\n '.': [' ', ' ', ' ', ' ', ' # '],\n '-': [' ', ' ', '###', ' ', ' '],\n ':': [' ', ' # ', ' ', ' # ', ' '],\n};\n\nconst CHAR_HEIGHT = 5;\nconst CHAR_WIDTH = 3;\n\n/**\n * BigText — renders text as large 5×3 ASCII art banner characters.\n *\n * Supports A–Z (uppercase), 0–9, and common punctuation.\n * Unrecognized characters fall back to a narrow glyph.\n */\nexport class BigText extends Widget {\n private _text: string;\n private _color: Color;\n\n constructor(text: string, style: Partial<Style> = {}, opts: BigTextOptions = {}) {\n super(style);\n this._text = text.toUpperCase();\n this._color = opts.color ?? { type: 'named', name: 'white' };\n }\n\n setText(text: string): void {\n this._text = text.toUpperCase();\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const fg = this._color;\n\n let curX = x;\n\n for (const ch of this._text) {\n const glyph = CHAR_MAP[ch] ?? ['# #', '# #', '# #', '# #', '# #'];\n const glyphWidth = glyph[0]?.length ?? CHAR_WIDTH;\n\n if (curX + glyphWidth > x + width) break;\n\n for (let row = 0; row < CHAR_HEIGHT && row < height; row++) {\n const rowStr = glyph[row] ?? '';\n for (let col = 0; col < rowStr.length; col++) {\n if (rowStr[col] !== ' ') {\n screen.setCell(curX + col, y + row, { char: '█', ...attrs, fg });\n }\n }\n }\n\n // Advance with 1 col gap between characters\n curX += glyphWidth + 1;\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Gradient widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, caps, parseColor } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface GradientOptions {\n /** Start color (hex string like '#ff0000' or named color string) */\n startColor?: string;\n /** End color (hex string like '#0000ff' or named color string) */\n endColor?: string;\n /** Text alignment */\n align?: 'left' | 'center' | 'right';\n}\n\n/** Parse a hex color string to [r, g, b] */\nfunction hexToRgb(hex: string): [number, number, number] | null {\n const clean = hex.replace('#', '');\n if (clean.length !== 6) return null;\n const r = parseInt(clean.slice(0, 2), 16);\n const g = parseInt(clean.slice(2, 4), 16);\n const b = parseInt(clean.slice(4, 6), 16);\n if (isNaN(r) || isNaN(g) || isNaN(b)) return null;\n return [r, g, b];\n}\n\n/** Interpolate between two RGB values at t ∈ [0,1] */\nfunction lerpRgb(a: [number, number, number], b: [number, number, number], t: number): [number, number, number] {\n return [\n Math.round(a[0] + (b[0] - a[0]) * t),\n Math.round(a[1] + (b[1] - a[1]) * t),\n Math.round(a[2] + (b[2] - a[2]) * t),\n ];\n}\n\n/**\n * Gradient — text rendered with a smooth color gradient.\n *\n * Each character is colored by linearly interpolating between startColor and endColor.\n * Falls back to a single foreground color if true-color is unavailable.\n */\nexport class Gradient extends Widget {\n private _text: string;\n private _startColor: string;\n private _endColor: string;\n private _align: 'left' | 'center' | 'right';\n\n constructor(text: string, style: Partial<Style> = {}, opts: GradientOptions = {}) {\n super({ height: 1, ...style });\n this._text = text;\n this._startColor = opts.startColor ?? '#ff0000';\n this._endColor = opts.endColor ?? '#0000ff';\n this._align = opts.align ?? 'left';\n }\n\n setText(text: string): void {\n this._text = text;\n this.markDirty();\n }\n\n setColors(start: string, end: string): void {\n this._startColor = start;\n this._endColor = end;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0 || !this._text) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Without color support: render plain text\n if (!caps.color) {\n screen.writeString(x, y, this._text.slice(0, width), attrs);\n return;\n }\n\n const startRgb = hexToRgb(this._startColor);\n const endRgb = hexToRgb(this._endColor);\n\n const chars = Array.from(this._text).slice(0, width);\n const len = chars.length;\n\n // Alignment offset\n let offsetX = 0;\n if (this._align === 'center') offsetX = Math.floor((width - len) / 2);\n else if (this._align === 'right') offsetX = width - len;\n offsetX = Math.max(0, offsetX);\n\n for (let i = 0; i < chars.length; i++) {\n const t = len > 1 ? i / (len - 1) : 0;\n\n let fg: import('@termuijs/core').Color;\n\n if (startRgb && endRgb) {\n const [r, g, b] = lerpRgb(startRgb, endRgb, t);\n fg = { type: 'rgb', r, g, b };\n } else if (startRgb) {\n // Fallback: use start color parsed as hex\n fg = parseColor(this._startColor) ?? attrs.fg;\n } else {\n fg = attrs.fg;\n }\n\n screen.setCell(x + offsetX + i, y, { char: chars[i] ?? ' ', ...attrs, fg });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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W;AAC1C,UAAM,SAAS,SAAS,KAAK,SAAS;AAEtC,UAAM,QAAQ,MAAM,KAAK,KAAK,KAAK,EAAE,MAAM,GAAG,KAAK;AACnD,UAAM,MAAM,MAAM;AAGlB,QAAI,UAAU;AACd,QAAI,KAAK,WAAW,SAAU,WAAU,KAAK,OAAO,QAAQ,OAAO,CAAC;AAAA,aAC3D,KAAK,WAAW,QAAS,WAAU,QAAQ;AACpD,cAAU,KAAK,IAAI,GAAG,OAAO;AAE7B,aAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACnC,YAAM,IAAI,MAAM,IAAI,KAAK,MAAM,KAAK;AAEpC,UAAI;AAEJ,UAAI,YAAY,QAAQ;AACpB,cAAM,CAAC,GAAG,GAAG,CAAC,IAAI,QAAQ,UAAU,QAAQ,CAAC;AAC7C,aAAK,EAAE,MAAM,OAAO,GAAG,GAAG,EAAE;AAAA,MAChC,WAAW,UAAU;AAEjB,iBAAK,0BAAW,KAAK,WAAW,KAAK,MAAM;AAAA,MAC/C,OAAO;AACH,aAAK,MAAM;AAAA,MACf;AAEA,aAAO,QAAQ,IAAI,UAAU,GAAG,GAAG,EAAE,MAAM,MAAM,CAAC,KAAK,KAAK,GAAG,OAAO,GAAG,CAAC;AAAA,IAC9E;AAAA,EACJ;AACJ;","names":["import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_motion","import_core","import_core","import_motion","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/base/Widget.ts","../src/display/Box.ts","../src/display/Text.ts","../src/display/LogView.ts","../src/ProgressBar/ProgressBar.ts","../src/display/Tree.ts","../src/display/JSONView.ts","../src/display/DiffView.ts","../src/display/StreamingText.ts","../src/display/ChatMessage.ts","../src/display/ToolCall.ts","../src/display/Canvas.ts","../src/display/Rating.ts","../src/display/Pty.ts","../src/input/virtual-scroll.ts","../src/input/List.ts","../src/data/ListState.ts","../src/input/VirtualList.ts","../src/input/CommandPalette.ts","../src/input/Button.ts","../src/input/Slider.ts","../src/input/RangeInput.ts","../src/input/TextInput.ts","../src/input/Knob.ts","../src/input/PinInput.ts","../src/input/ContextMenu.ts","../src/data/Table.ts","../src/data/TableState.ts","../src/data/TreeTable.ts","../src/data/Gauge.ts","../src/data/LineGauge.ts","../src/data/Calendar.ts","../src/data/Sparkline.ts","../src/data/BrailleCanvas.ts","../src/data/StatusIndicator.ts","../src/data/BarChart.ts","../src/data/Histogram.ts","../src/data/StackedBarChart.ts","../src/data/GanttChart.ts","../src/layout/Grid.ts","../src/layout/ScrollView.ts","../src/layout/scroll-acceleration.ts","../src/layout/Center.ts","../src/layout/Card.ts","../src/layout/Masonry.ts","../src/layout/Columns.ts","../src/layout/Dock.ts","../src/layout/Divider.ts","../src/layout/AspectRatio.ts","../src/layout/Fill.ts","../src/layout/SplitPane.ts","../src/feedback/ProgressBar.ts","../src/feedback/MultiProgress.ts","../src/feedback/Spinner.ts","../src/feedback/LoadingDots.ts","../src/feedback/TaskList.ts","../src/feedback/Scrollbar.ts","../src/feedback/Skeleton.ts","../src/feedback/StatusMessage.ts","../src/feedback/Banner.ts","../src/feedback/Alert.ts","../src/feedback/EmptyState.ts","../src/feedback/Callout.ts","../src/data/KeyValue.ts","../src/data/Sidebar.ts","../src/data/LineChart.ts","../src/data/AreaChart.ts","../src/data/HeatMap.ts","../src/data/Definition.ts","../src/data/Hexdump.ts","../src/data/BulletChart.ts","../src/display/Breadcrumbs.ts","../src/display/Avatar.ts","../src/display/BigText.ts","../src/display/Gradient.ts","../src/display/Markdown.ts","../src/display/Code.ts","../src/display/Badge.ts","../src/display/Kbd.ts","../src/display/Tag.ts","../src/display/Placeholder.ts","../src/display/Watermark.ts","../src/display/NotificationBadge.ts","../src/display/Carousel.ts","../src/display/Tooltip.ts","../src/layout/Panel.ts","../src/display/Clock.ts","../src/display/Digits.ts","../src/display/Link.ts","../src/display/ShortcutBar.ts","../src/display/Accordion.ts","../src/display/Stepper.ts","../src/display/QRCode.ts","../src/layout/Stack.ts","../src/data/ScatterPlot.ts","../src/data/RadarChart.ts","../src/data/Stat.ts","../src/data/CandlestickChart.ts","../src/display/Timer.ts","../src/display/Stopwatch.ts","../src/display/OrderedList.ts","../src/display/Typewriter.ts","../src/display/Timeline.ts","../src/display/Marquee.ts","../src/data/DataGrid.ts","../src/data/PieChart.ts","../src/feedback/ProgressColumn.ts","../src/feedback/Progress.ts","../src/display/Highlight.ts","../src/display/ThinkingBlock.ts","../src/display/Collapsible.ts","../src/display/DirectoryTree.ts","../src/display/UnorderedList.ts","../src/display/Rule.ts"],"sourcesContent":["// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Public API\n// ─────────────────────────────────────────────────────\n\n// ── Base ──────────────────────────────────────────────\nexport { Widget, _resetWidgetIdCounter } from './base/Widget.js';\nexport type { WidgetEvents } from './base/Widget.js';\n\n// ── Display Widgets ───────────────────────────────────\nexport { Box } from './display/Box.js';\nexport { Text } from './display/Text.js';\nexport type { TextProps } from './display/Text.js';\nexport { LogView } from './display/LogView.js';\nexport type { LogViewOptions } from './display/LogView.js';\nexport { ProgressString } from './ProgressBar/ProgressBar.js';\nexport type { ProgressStringProps, ProgressBarStyle } from './ProgressBar/ProgressBar.js';\nexport { Tree } from './display/Tree.js';\nexport type { TreeNode, TreeOptions } from './display/Tree.js';\nexport { JSONView, jsonToTree } from './display/JSONView.js';\nexport type { JSONViewOptions, JSONNodeData, JSONNodeType } from './display/JSONView.js';\nexport { DiffView } from './display/DiffView.js';\nexport type { DiffLine, DiffViewOptions } from './display/DiffView.js';\nexport { StreamingText } from './display/StreamingText.js';\nexport type { StreamingTextOptions } from './display/StreamingText.js';\nexport { ChatMessage } from './display/ChatMessage.js';\nexport type { ChatMessageOptions, MessageRole } from './display/ChatMessage.js';\nexport { ToolCall, ToolApproval } from './display/ToolCall.js';\nexport type { ToolCallOptions, ToolApprovalOptions, ToolCallStatus } from './display/ToolCall.js';\nexport { Canvas } from './display/Canvas.js';\nexport { Rating } from './display/Rating.js';\nexport type { RatingOptions } from './display/Rating.js';\nexport { Pty } from './display/Pty.js';\nexport type { PtyOptions } from './display/Pty.js';\n\n// ── Virtual Scroll Helpers ────────────────────────────\nexport { computeRange, computeVariableRange } from './input/virtual-scroll.js';\nexport type { ScrollRange } from './input/virtual-scroll.js';\n\n// ── Input Widgets ─────────────────────────────────────\nexport { List } from './input/List.js';\nexport type { ListItem, ListProps } from './input/List.js';\nexport { useListState } from './data/ListState.js';\nexport type { ListState } from './data/ListState.js';\nexport { VirtualList } from './input/VirtualList.js';\nexport type { VirtualListOptions } from './input/VirtualList.js';\nexport { CommandPalette } from './input/CommandPalette.js';\nexport type { Command, CommandPaletteOptions } from './input/CommandPalette.js';\nexport { Button } from './input/Button.js';\nexport type { ButtonOptions, ButtonVariant } from './input/Button.js';\n\nexport { Slider } from \"./input/Slider.js\";\nexport type { SliderOptions } from \"./input/Slider.js\";\nexport { RangeInput } from \"./input/RangeInput.js\";\nexport type { RangeInputOptions } from \"./input/RangeInput.js\";\nexport { TextInput } from './input/TextInput.js';\nexport { Knob } from \"./input/Knob.js\";\nexport type { KnobOptions } from \"./input/Knob.js\";\nexport { PinInput } from \"./input/PinInput.js\";\nexport type { PinInputOptions } from \"./input/PinInput.js\";\nexport { ContextMenu } from './input/ContextMenu.js';\nexport type { ContextMenuItem } from './input/ContextMenu.js';\n\n// ── Data Widgets ──────────────────────────────────────\nexport { Table } from './data/Table.js';\nexport type { TableColumn, TableRow, TableOptions, TableProps } from './data/Table.js';\nexport { useTableState } from './data/TableState.js';\nexport type { TableState } from './data/TableState.js';\nexport { TreeTable } from './data/TreeTable.js';\nexport type { TreeTableColumn, TreeTableRow, TreeTableOptions } from './data/TreeTable.js';\nexport { Gauge } from './data/Gauge.js';\nexport type { GaugeOptions } from './data/Gauge.js';\nexport { LineGauge } from './data/LineGauge.js';\nexport type { LineGaugeOptions } from './data/LineGauge.js';\nexport { Calendar } from './data/Calendar.js';\nexport type { CalendarOptions } from './data/Calendar.js';\nexport { Sparkline } from './data/Sparkline.js';\nexport type { SparklineOptions } from './data/Sparkline.js';\nexport { StatusIndicator } from './data/StatusIndicator.js';\nexport type { StatusIndicatorOptions } from './data/StatusIndicator.js';\nexport { BarChart } from './data/BarChart.js';\nexport type { Bar, BarGroup, BarChartDirection, BarChartOptions } from './data/BarChart.js';\n\nexport { Histogram } from './data/Histogram.js';\nexport type { HistogramOptions } from './data/Histogram.js';\n\nexport { StackedBarChart } from './data/StackedBarChart.js';\nexport type { StackedBarChartOptions, StackedSeries } from './data/StackedBarChart.js';\n\nexport { GanttChart } from './data/GanttChart.js';\nexport type { GanttChartOptions, GanttTask } from './data/GanttChart.js';\n\n// ── Layout Widgets ────────────────────────────────────\nexport { Grid } from './layout/Grid.js';\nexport type { GridOptions } from './layout/Grid.js';\nexport { ScrollView } from './layout/ScrollView.js';\nexport type { ScrollViewOptions } from './layout/ScrollView.js';\nexport { Center } from './layout/Center.js';\nexport type { CenterOptions } from './layout/Center.js';\nexport { Card } from './layout/Card.js';\nexport type { CardOptions } from './layout/Card.js';\nexport { Masonry } from './layout/Masonry.js';\nexport type { MasonryOptions } from './layout/Masonry.js';\nexport { Columns } from './layout/Columns.js';\nexport type { ColumnsOptions } from './layout/Columns.js';\nexport { Dock } from './layout/Dock.js';\nexport type { DockOptions, DockItem, DockEdge } from './layout/Dock.js';\nexport { Divider } from './layout/Divider.js';\nexport type { DividerOptions, DividerOrientation } from './layout/Divider.js';\nexport { AspectRatio } from './layout/AspectRatio.js';\nexport type { AspectRatioOptions } from './layout/AspectRatio.js';\nexport { Fill } from './layout/Fill.js';\nexport type { FillOptions } from './layout/Fill.js';\nexport { SplitPane } from './layout/SplitPane.js';\nexport type { SplitPaneOptions } from './layout/SplitPane.js';\n\n// ── Feedback Widgets ──────────────────────────────────\nexport { ProgressBar } from './feedback/ProgressBar.js';\nexport type { ProgressBarOptions } from './feedback/ProgressBar.js';\nexport { MultiProgress } from './feedback/MultiProgress.js';\nexport type { ProgressItem, MultiProgressOptions } from './feedback/MultiProgress.js';\nexport { Spinner, SPINNER_FRAMES } from './feedback/Spinner.js';\nexport type { SpinnerOptions } from './feedback/Spinner.js';\nexport { LoadingDots } from './feedback/LoadingDots.js';\nexport type { LoadingDotsOptions } from './feedback/LoadingDots.js';\nexport { TaskList } from './feedback/TaskList.js';\nexport type { TaskItem, TaskStatus, TaskListOptions } from './feedback/TaskList.js';\nexport { Scrollbar } from './feedback/Scrollbar.js';\nexport type { ScrollbarOrientation, ScrollbarOptions } from './feedback/Scrollbar.js';\n\nexport { Skeleton } from './feedback/Skeleton.js';\nexport type { SkeletonOptions } from './feedback/Skeleton.js';\nexport { StatusMessage } from './feedback/StatusMessage.js';\nexport type { StatusMessageOptions, StatusVariant } from './feedback/StatusMessage.js';\nexport { Banner } from './feedback/Banner.js';\nexport type { BannerOptions } from './feedback/Banner.js';\nexport { Alert } from './feedback/Alert.js';\nexport type { AlertOptions } from './feedback/Alert.js';\n\nexport { EmptyState } from './feedback/EmptyState.js';\nexport type { EmptyStateOptions } from './feedback/EmptyState.js';\n\nexport { Callout } from './feedback/Callout.js';\nexport type { CalloutVariant, CalloutOptions } from './feedback/Callout.js';\n\n// ── New Data Widgets ──────────────────────────────────\nexport { KeyValue } from './data/KeyValue.js';\nexport type { KeyValuePair, KeyValueOptions } from './data/KeyValue.js';\nexport { Sidebar } from './data/Sidebar.js';\nexport type { SidebarItem, SidebarOptions } from './data/Sidebar.js';\nexport { LineChart } from './data/LineChart.js';\nexport type { LineChartOptions } from './data/LineChart.js';\nexport { AreaChart } from './data/AreaChart.js';\nexport type { AreaChartOptions } from './data/AreaChart.js';\nexport { HeatMap } from './data/HeatMap.js';\nexport type { HeatMapOptions } from './data/HeatMap.js';\nexport { Definition } from './data/Definition.js';\nexport type { DefinitionPair, DefinitionOptions } from './data/Definition.js';\nexport { Hexdump } from './data/Hexdump.js';\nexport type { HexdumpOptions } from './data/Hexdump.js';\nexport { BulletChart } from './data/BulletChart.js';\nexport type { BulletChartOptions, BulletRange } from './data/BulletChart.js';\n\n// ── New Display Widgets ───────────────────────────────\nexport { Breadcrumbs } from './display/Breadcrumbs.js';\nexport type { BreadcrumbsOptions } from './display/Breadcrumbs.js';\nexport { Avatar } from './display/Avatar.js';\nexport type { AvatarOptions } from './display/Avatar.js';\n\nexport { BigText } from './display/BigText.js';\nexport type { BigTextOptions } from './display/BigText.js';\nexport { Gradient } from './display/Gradient.js';\nexport type { GradientOptions } from './display/Gradient.js';\n\nexport { Markdown } from './display/Markdown.js';\nexport type { MarkdownOptions } from './display/Markdown.js';\nexport { Code } from './display/Code.js';\nexport type { CodeOptions } from './display/Code.js';\nexport { Badge } from './display/Badge.js';\nexport type { BadgeOptions, BadgeVariant } from './display/Badge.js';\nexport { Kbd } from './display/Kbd.js';\nexport type { KbdOptions } from './display/Kbd.js';\nexport { Tag } from './display/Tag.js';\nexport type { TagOptions, TagVariant } from './display/Tag.js';\nexport { Placeholder } from './display/Placeholder.js';\nexport type { PlaceholderOptions } from './display/Placeholder.js';\nexport { Watermark } from './display/Watermark.js';\nexport type { WatermarkOptions } from './display/Watermark.js';\nexport { NotificationBadge } from './display/NotificationBadge.js';\nexport type { NotificationBadgeOptions, BadgePosition } from './display/NotificationBadge.js';\n\nexport { Carousel } from './display/Carousel.js';\nexport type { CarouselOptions } from './display/Carousel.js';\n\nexport { Tooltip } from './display/Tooltip.js';\nexport type { TooltipOptions } from './display/Tooltip.js';\n\nexport { Panel } from './layout/Panel.js';\nexport { Clock } from './display/Clock.js';\nexport type { ClockOptions } from './display/Clock.js';\n\nexport { Link } from './display/Link.js';\nexport type { LinkOptions } from './display/Link.js';\n\nexport { ShortcutBar } from './display/ShortcutBar.js';\nexport type { ShortcutItem, ShortcutBarOptions } from './display/ShortcutBar.js';\n\nexport { Accordion } from './display/Accordion.js';\nexport type { AccordionSection, AccordionOptions } from './display/Accordion.js';\n\nexport { Stepper } from './display/Stepper.js';\nexport type { StepperStep, StepperOptions, StepStatus, StepperOrientation } from './display/Stepper.js';\n\n\n// ── Missing layout elements restored ──\nexport { QRCodePattern, QRCode } from './display/QRCode.js';\nexport type { QRCodePatternOptions, QRCodeOptions } from './display/QRCode.js';\nexport { Stack } from './layout/Stack.js';\nexport type { StackOptions } from './layout/Stack.js';\nexport { ScatterPlot } from './data/ScatterPlot.js';\nexport type { ScatterPlotOptions, ScatterPoint } from './data/ScatterPlot.js';\nexport { RadarChart } from './data/RadarChart.js';\nexport type { RadarChartOptions, RadarSeries } from './data/RadarChart.js';\nexport { Stat } from './data/Stat.js';\nexport type { StatOptions } from './data/Stat.js';\n\nexport { CandlestickChart } from './data/CandlestickChart.js';\nexport type { CandlestickChartOptions, Candle } from './data/CandlestickChart.js';\nexport { Timer } from './display/Timer.js';\nexport type { TimerOptions } from './display/Timer.js';\nexport { Stopwatch } from './display/Stopwatch.js';\nexport type { StopwatchOptions } from './display/Stopwatch.js';\nexport { OrderedList } from './display/OrderedList.js';\nexport type { OrderedListItem, OrderedListOptions } from './display/OrderedList.js';\nexport { Typewriter } from './display/Typewriter.js';\nexport type { TypewriterOptions } from './display/Typewriter.js';\n\nexport { Timeline } from './display/Timeline.js';\nexport type { TimelineItem, TimelineStatus } from './display/Timeline.js';\n\nexport { Marquee } from './display/Marquee.js';\nexport type { MarqueeDirection, MarqueeOptions } from './display/Marquee.js';\nexport { DataGrid } from './data/DataGrid.js';\nexport { DataGrid as DataGridView } from './data/DataGrid.js';\nexport type { DataGridColumn, DataGridRow, DataGridOptions, SortDirection } from './data/DataGrid.js';\nexport { ScrollAcceleration } from './layout/scroll-acceleration.js';\nexport { PieChart } from './data/PieChart.js';\nexport type { PieSlice, PieChartOptions } from './data/PieChart.js';\n\nexport * from './data/BrailleCanvas.js';\nexport * from './data/Sparkline.js';\nexport * from './data/LineChart.js';\n\nexport {\n BarColumn,\n TextColumn,\n TimeColumn,\n SpeedColumn,\n PercentageColumn,\n} from './feedback/ProgressColumn.js';\n\nexport type {\n ProgressColumnDefinition,\n ProgressColumnProps,\n} from './feedback/ProgressColumn.js';\nexport { Progress } from './feedback/Progress.js';\n\nexport type {\n ProgressProps,\n ProgressTask,\n} from './feedback/Progress.js';\nexport * from './display/Highlight.js';\n\n// ── Additional Display Widgets ────────────────────────\nexport { ThinkingBlock } from './display/ThinkingBlock.js';\nexport type { ThinkingBlockOptions } from './display/ThinkingBlock.js';\nexport { Collapsible } from './display/Collapsible.js';\nexport type { CollapsibleOptions } from './display/Collapsible.js';\nexport { Digits } from './display/Digits.js';\nexport type { DigitsOptions } from './display/Digits.js';\nexport { DirectoryTree } from './display/DirectoryTree.js';\nexport type { DirectoryTreeOptions } from './display/DirectoryTree.js';\nexport { UnorderedList } from './display/UnorderedList.js';\nexport type { UnorderedListOptions } from './display/UnorderedList.js';\nexport { Rule } from './display/Rule.js';\nexport type { RuleOrientation, RuleOptions } from './display/Rule.js';\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Base Widget class\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type LayoutNode,\n type Rect,\n type KeyEvent,\n type MouseEvent as TermMouseEvent,\n defaultStyle,\n mergeStyles,\n createLayoutNode,\n EventEmitter,\n normalizeEdges,\n getBorderChars,\n styleToCellAttrs,\n containsPoint,\n caps,\n} from '@termuijs/core';\nimport { animateRect, type SpringConfig, type SpringPresetName } from '@termuijs/motion';\n\n/**\n * Event map for widgets.\n */\nexport interface WidgetEvents {\n key: KeyEvent;\n mouse: TermMouseEvent;\n focus: void;\n blur: void;\n mount: void;\n unmount: void;\n}\n\nlet _widgetIdCounter = 0;\n\n/** Reset the widget ID counter (for testing only). */\nexport function _resetWidgetIdCounter(): void {\n _widgetIdCounter = 0;\n}\n\n/**\n * Base class for all TermUI widgets.\n *\n * CONSTRUCTOR SIGNATURE CONVENTION:\n * - Simple display widgets: (content?, style?: Partial<Style>, opts?: SpecificOptions)\n * - Data widgets: (data, style?: Partial<Style>, opts?: SpecificOptions)\n * - Compound UI widgets: (options: SpecificOptions, style?: Partial<Style>)\n *\n * FOCUSABLE PATTERN:\n * Set `focusable = true` as a class field initializer, OR in the constructor\n * body after calling `super()`. Do NOT set it inside `_renderSelf()`.\n *\n * STYLE MERGE PATTERN:\n * All widgets should call `super(mergeStyles(defaultStyle(), { ...defaults }, style))`\n * to produce consistent base styles. For widgets that accept `style` as the\n * second parameter, pass it directly through to `super()`.\n *\n * Provides:\n * - Unique ID generation\n * - Style management and merging\n * - Layout node generation with rect sync\n * - Border/padding rendering into the screen buffer\n * - Child management\n * - Focus support\n * - Event emission\n */\nexport abstract class Widget {\n /** Unique widget identifier */\n readonly id: string;\n\n /** Widget's style */\n protected _style: Style;\n\n /** Child widgets */\n protected _children: Widget[] = [];\n\n /** Parent widget (null for root) */\n parent: Widget | null = null;\n\n /** Computed layout rectangle */\n protected _rect: Rect = { x: 0, y: 0, width: 0, height: 0 };\n\n /** Reference to the layout node (set during getLayoutNode) */\n private _layoutNode: LayoutNode | null = null;\n\n /** Error from last render call, null if no error */\n protected _renderError: Error | null = null;\n\n /** Whether this widget can receive focus */\n focusable = false;\n\n /** Tab index for focus ordering */\n tabIndex = 0;\n\n /** Event emitter for this widget */\n readonly events = new EventEmitter<WidgetEvents>();\n\n /** Whether the widget is currently focused */\n isFocused = false;\n\n /**\n * Dirty flag — true when this widget needs re-rendering.\n * Newly created widgets start dirty.\n */\n protected _dirty = true;\n\n /** Enable animated layout transitions for size/position changes */\n public layoutTransition: Partial<SpringConfig> | SpringPresetName | boolean = false;\n private _layoutCancel: (() => void) | null = null;\n private _targetRect: Rect | null = null;\n\n constructor(style: Partial<Style> = {}) {\n this.id = `widget_${++_widgetIdCounter}`;\n this._style = mergeStyles(defaultStyle(), style);\n }\n\n /** Check if this widget is currently active (focused) */\n isActive(): boolean {\n return this.isFocused;\n }\n\n /** Get the current style */\n get style(): Style { return this._style; }\n\n /** Update the style (merge with existing) */\n setStyle(style: Partial<Style>): void {\n this._style = mergeStyles(this._style, style);\n this.markDirty();\n }\n\n /** Get the computed rect after layout */\n get rect(): Rect { return this._rect; }\n\n /** Add a child widget */\n addChild(child: Widget): void {\n child.parent = this;\n this._children.push(child);\n }\n\n /** Remove a child widget */\n removeChild(child: Widget): void {\n const idx = this._children.indexOf(child);\n if (idx >= 0) {\n this._children.splice(idx, 1);\n child.destroy();\n }\n }\n\n /** Remove all children */\n clearChildren(): void {\n const children = [...this._children];\n this._children = [];\n for (const child of children) {\n child.destroy();\n }\n }\n\n /**\n * Destroy this widget and all its descendants.\n * Cleans up event handlers, removes parent references, and clears children.\n * Fiber-level cleanup is handled by the reconciler's _pruneInstancesForWidget.\n */\n destroy(): void {\n const children = [...this._children];\n this._children = [];\n for (const child of children) {\n child.destroy();\n }\n this.events.emit('unmount', undefined as any); // as any: EventEmitter payload typed as never for void events; cast required\n this.events.removeAll();\n this.parent = null;\n }\n\n /** Get all children */\n get children(): ReadonlyArray<Widget> { return this._children; }\n\n /**\n * Build the LayoutNode tree for this widget.\n * Stores a reference so we can sync computed rects back via syncLayout().\n */\n getLayoutNode(): LayoutNode {\n const childNodes = this._children\n .filter(c => c.style.visible !== false)\n .map(c => c.getLayoutNode());\n\n if (this._layoutNode) {\n this._layoutNode.style = this._style;\n this._layoutNode.children = childNodes;\n } else {\n this._layoutNode = createLayoutNode(this.id, this._style, childNodes);\n }\n return this._layoutNode;\n }\n\n /**\n * After computeLayout() has been called, sync the computed rects\n * from the layout tree back into widget `_rect` fields.\n * This MUST be called after computeLayout() and before render().\n */\n syncLayout(): void {\n if (this._layoutNode) {\n this._applyRect({ ...this._layoutNode.computed });\n }\n\n // Sync children (match visible children to layout node children)\n const visibleChildren = this._children.filter(c => c.style.visible !== false);\n for (let i = 0; i < visibleChildren.length; i++) {\n visibleChildren[i].syncLayout();\n }\n }\n\n /**\n * Render this widget (and children) into the screen buffer.\n * Automatically pushes a clip region if overflow is hidden (default).\n */\n render(screen: Screen): void {\n if (this._style.visible === false) return;\n\n // Push clip region if overflow is hidden (default style)\n const shouldClip = this._style.overflow !== 'visible';\n if (shouldClip) {\n screen.pushClip(this._rect);\n }\n\n // Render own content with error isolation\n try {\n this._renderSelf(screen);\n this._renderError = null;\n this._dirty = false;\n } catch (err) {\n this._renderError = err instanceof Error ? err : new Error(String(err));\n // Keep widget dirty so it will be retried on the next frame\n this._dirty = true;\n // Visual fallback in dev mode — show a red placeholder with widget name\n if (process.env.NODE_ENV !== 'production') {\n const { x, y, width } = this._rect;\n if (width > 2) {\n const label = `Error: ${this.constructor.name}`;\n const truncated = label.slice(0, Math.max(3, width - 2));\n screen.writeString(x + 1, y, truncated, {\n fg: { type: 'named', name: 'red' },\n });\n }\n }\n }\n\n // Render border\n this._renderBorder(screen);\n\n // Render children\n for (const child of this._children) {\n child.render(screen);\n }\n\n // Pop clip region\n if (shouldClip) {\n screen.popClip();\n }\n }\n\n /**\n * Override this to render the widget's own content.\n * The rect is available as `this._rect`.\n */\n protected abstract _renderSelf(screen: Screen): void;\n\n /**\n * Update the computed rect from layout results.\n */\n updateRect(rect: Rect): void {\n this._applyRect(rect);\n }\n\n private _applyRect(newRect: Rect): void {\n if (this._rect.width === 0 && this._rect.height === 0) {\n // First render, do not animate\n this._rect = newRect;\n return;\n }\n\n if (!this.layoutTransition) {\n if (this._layoutCancel) {\n this._layoutCancel();\n this._layoutCancel = null;\n this._targetRect = null;\n }\n this._rect = newRect;\n return;\n }\n \n // If target is same, ignore\n if (this._targetRect && \n this._targetRect.x === newRect.x && \n this._targetRect.y === newRect.y && \n this._targetRect.width === newRect.width && \n this._targetRect.height === newRect.height) {\n return;\n }\n \n if (this._rect.x === newRect.x && \n this._rect.y === newRect.y && \n this._rect.width === newRect.width && \n this._rect.height === newRect.height) {\n return;\n }\n \n if (this._layoutCancel) {\n this._layoutCancel();\n }\n \n this._targetRect = { ...newRect };\n \n const config = typeof this.layoutTransition === 'boolean' \n ? 'default' \n : this.layoutTransition;\n \n this._layoutCancel = animateRect(this._rect, newRect, {\n config,\n onFrame: (rect) => {\n this._rect = rect;\n this.markDirty();\n },\n onComplete: () => {\n this._layoutCancel = null;\n this._targetRect = null;\n }\n });\n }\n\n /**\n * Mark this widget as needing re-render.\n * Propagates up to parent so the render loop can detect changes.\n */\n markDirty(): void {\n if (this._dirty) return; // Already dirty\n this._dirty = true;\n if (this._layoutNode) {\n this._layoutNode._dirty = true;\n }\n this.parent?.markDirty();\n }\n\n /**\n * Clear the dirty flag after rendering.\n * Widgets with a render error stay dirty so they are retried on the next frame.\n */\n clearDirty(): void {\n if (this._renderError) {\n this._dirty = true;\n return;\n }\n this._dirty = false;\n for (const child of this._children) {\n child.clearDirty();\n // If child remains dirty due to render error, keep ancestor dirty too\n if (child._dirty) {\n this._dirty = true;\n }\n }\n }\n\n /** Check if this widget (or any child) needs re-rendering */\n get isDirty(): boolean { return this._dirty; }\n\n /** Get the last render error, if any */\n get renderError(): Error | null { return this._renderError; }\n\n /**\n * Render the border around this widget, including focus ring if focused.\n */\n protected _renderBorder(screen: Screen): void {\n const border = this._style.border;\n const hasBorder = border && border !== 'none';\n const showFocusRing = this.isFocused && this.focusable\n && this._style.focusRingStyle !== 'none';\n\n if (!hasBorder && !showFocusRing) return;\n\n const { x, y, width, height } = this._rect;\n if (width < 2 || height < 2) return;\n\n if (hasBorder) {\n const useAscii =\n (this._style.asciiOnly ?? false) || !caps.unicode;\n\n const chars = getBorderChars(\n border,\n undefined,\n useAscii\n );\n\n if (!chars) return;\n\n const attrs = styleToCellAttrs(this._style);\n const borderFg = this._style.borderColor ?? attrs.fg;\n\n // Use focus ring color when focused, otherwise normal border color\n const fg = showFocusRing\n ? (this._style.focusRingColor ?? { type: 'named' as const, name: 'cyan' as const })\n : borderFg;\n const cellStyle = { fg };\n\n // Top edge\n screen.setCell(x, y, { char: chars.topLeft, ...cellStyle });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y, { char: chars.top, ...cellStyle });\n }\n screen.setCell(x + width - 1, y, { char: chars.topRight, ...cellStyle });\n\n // Bottom edge\n screen.setCell(x, y + height - 1, { char: chars.bottomLeft, ...cellStyle });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y + height - 1, { char: chars.bottom, ...cellStyle });\n }\n screen.setCell(x + width - 1, y + height - 1, { char: chars.bottomRight, ...cellStyle });\n\n // Left and right edges\n for (let r = 1; r < height - 1; r++) {\n screen.setCell(x, y + r, { char: chars.left, ...cellStyle });\n screen.setCell(x + width - 1, y + r, { char: chars.right, ...cellStyle });\n }\n } else if (showFocusRing) {\n // No border — render corner bracket focus indicators\n const fg = this._style.focusRingColor ?? { type: 'named' as const, name: 'cyan' as const };\n const cellStyle = { fg, bold: true };\n\n // Top-left corner\n screen.setCell(x, y, { char: '┌', ...cellStyle });\n if (width > 2) screen.setCell(x + 1, y, { char: '─', ...cellStyle });\n\n // Top-right corner\n screen.setCell(x + width - 1, y, { char: '┐', ...cellStyle });\n if (width > 2) screen.setCell(x + width - 2, y, { char: '─', ...cellStyle });\n\n // Bottom-left corner\n screen.setCell(x, y + height - 1, { char: '└', ...cellStyle });\n if (width > 2) screen.setCell(x + 1, y + height - 1, { char: '─', ...cellStyle });\n\n // Bottom-right corner\n screen.setCell(x + width - 1, y + height - 1, { char: '┘', ...cellStyle });\n if (width > 2) screen.setCell(x + width - 2, y + height - 1, { char: '─', ...cellStyle });\n\n // Short vertical marks if tall enough\n if (height > 2) {\n screen.setCell(x, y + 1, { char: '│', ...cellStyle });\n screen.setCell(x + width - 1, y + 1, { char: '│', ...cellStyle });\n screen.setCell(x, y + height - 2, { char: '│', ...cellStyle });\n screen.setCell(x + width - 1, y + height - 2, { char: '│', ...cellStyle });\n }\n }\n }\n\n /**\n * Get the inner content area (after border + padding).\n */\n protected _getContentRect(): Rect {\n const padding = normalizeEdges(this._style.padding);\n const border = this._style.border && this._style.border !== 'none' ? 1 : 0;\n\n return {\n x: this._rect.x + padding.left + border,\n y: this._rect.y + padding.top + border,\n width: Math.max(0, this._rect.width - padding.left - padding.right - border * 2),\n height: Math.max(0, this._rect.height - padding.top - padding.bottom - border * 2),\n };\n }\n\n /**\n * Check if a point hits this widget.\n */\n hitTest(x: number, y: number): boolean {\n return containsPoint(this._rect, x, y);\n }\n\n /** Lifecycle: called when the widget is mounted */\n mount(): void {\n this.events.emit('mount', undefined as any); // as any: EventEmitter payload typed as never for void events; cast required\n for (const child of this._children) {\n child.mount();\n }\n }\n\n /** Lifecycle: called when the widget is unmounted */\n unmount(): void {\n for (const child of this._children) {\n child.unmount();\n }\n this.events.emit('unmount', undefined as any); // as any: EventEmitter payload typed as never for void events; cast required\n this.events.removeAll();\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Box widget\n// ─────────────────────────────────────────────────────\n\nimport type { Screen, Style } from '@termuijs/core';\nimport { styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * Box — the fundamental container widget, similar to a `<div>`.\n *\n * Supports:\n * - Flexbox layout (row/column)\n * - Border styles (single/double/round/heavy/dashed)\n * - Padding and margin\n * - Background color\n */\nexport class Box extends Widget {\n constructor(style: Partial<Style> = {}) {\n super(style);\n }\n /** Check if this Box has no children */\n isEmpty(): boolean {\n return this._children.length === 0;\n }\n\n protected _renderSelf(screen: Screen): void {\n const { bg } = styleToCellAttrs(this._style);\n if (bg.type === 'none') return;\n\n const { x, y, width, height } = this._rect;\n const border = this._style.border && this._style.border !== 'none' ? 1 : 0;\n\n // Fill background\n for (let r = border; r < height - border; r++) {\n for (let c = border; c < width - border; c++) {\n screen.setCell(x + c, y + r, { char: ' ', bg });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Text widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, wordWrap, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface TextProps {\n content: string;\n wrap?: boolean;\n align?: 'left' | 'center' | 'right';\n /** Vertical scroll offset (lines to skip from top). Default: 0. */\n scrollY?: number;\n /** Horizontal scroll offset (columns to skip from left). Default: 0. */\n scrollX?: number;\n}\n\n/**\n * Text — renders a string of text with word-wrapping, alignment, and scrolling.\n */\nexport class Text extends Widget {\n private _content: string;\n private _wrap: boolean;\n private _align: 'left' | 'center' | 'right';\n private _scrollY: number;\n private _scrollX: number;\n\n constructor(content: string, style: Partial<Style> = {}, props: Partial<TextProps> = {}) {\n super(style);\n this._content = content;\n this._wrap = props.wrap ?? true;\n this._align = props.align ?? 'left';\n this._scrollY = props.scrollY ?? 0;\n this._scrollX = props.scrollX ?? 0;\n }\n\n /** Update the text content */\n setContent(content: string): void {\n if (content === this._content) {\n return;\n }\n this._content = content;\n this.markDirty();\n }\n\n /** Get current text content */\n getContent(): string {\n return this._content;\n }\n\n toString(): string {\n return this._content;\n }\n\n /** Set vertical scroll offset (lines to skip). */\n setScrollY(offset: number): void {\n const normalized = Math.max(0, offset);\n if (normalized === this._scrollY) {\n return;\n }\n this._scrollY = normalized;\n this.markDirty();\n }\n\n /** Set horizontal scroll offset (columns to skip). */\n setScrollX(offset: number): void {\n const normalized = Math.max(0, offset);\n if (normalized === this._scrollX) {\n return;\n }\n this._scrollX = normalized;\n this.markDirty();\n }\n\n /** Get the total number of lines after wrapping. */\n getLineCount(): number {\n const contentRect = this._getContentRect();\n const text = this._wrap ? wordWrap(this._content, contentRect.width) : this._content;\n return text.split('\\n').length;\n }\n\n protected _renderSelf(screen: Screen): void {\n const contentRect = this._getContentRect();\n const { x, y, width, height } = contentRect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Word-wrap if enabled\n let text = this._wrap ? wordWrap(this._content, width) : this._content;\n const allLines = text.split('\\n');\n\n // Apply vertical scroll\n const startLine = Math.min(this._scrollY, allLines.length);\n const visibleLines = allLines.slice(startLine, startLine + height);\n\n for (let i = 0; i < Math.min(visibleLines.length, height); i++) {\n let line = visibleLines[i];\n if (line === undefined) continue;\n\n // Apply horizontal scroll\n if (this._scrollX > 0) {\n // Skip scrollX characters\n let skipped = 0;\n let charIndex = 0;\n for (const ch of line) {\n if (skipped >= this._scrollX) break;\n skipped++;\n charIndex += ch.length;\n }\n line = line.slice(charIndex);\n }\n\n const lineWidth = stringWidth(line);\n\n // Apply alignment\n let offsetX = 0;\n if (this._align === 'center') {\n offsetX = Math.floor((width - lineWidth) / 2);\n } else if (this._align === 'right') {\n offsetX = width - lineWidth;\n }\n\n screen.writeString(x + Math.max(0, offsetX), y + i, line, attrs);\n }\n }\n}\n\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — LogView widget (scrollable log)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface LogViewOptions {\n /** Highlight rules: keyword → color */\n highlight?: Record<string, Color>;\n /** Auto-scroll to bottom */\n autoScroll?: boolean;\n /** Maximum lines to retain (0 = unlimited) */\n maxLines?: number;\n}\n\n/**\n * LogView — scrollable, highlighted log output.\n *\n * Supports keyword-based color highlighting (ERROR → red, WARN → yellow, etc.)\n */\nexport class LogView extends Widget {\n private _lines: string[] = [];\n private _scrollOffset = 0;\n private _highlight: Record<string, Color>;\n private _autoScroll: boolean;\n private _maxLines: number;\n\n constructor(style: Partial<Style> = {}, opts: LogViewOptions = {}) {\n super(style);\n this._highlight = opts.highlight ?? {\n ERROR: { type: 'named', name: 'red' },\n WARN: { type: 'named', name: 'yellow' },\n INFO: { type: 'named', name: 'green' },\n DEBUG: { type: 'named', name: 'brightBlack' },\n };\n this._autoScroll = opts.autoScroll ?? true;\n this._maxLines = opts.maxLines ?? 0;\n }\n\n setLines(lines: string[]): void {\n this._lines = lines;\n if (this._autoScroll) {\n this._scrollToBottom();\n }\n this.markDirty();\n }\n\n appendLine(line: string): void {\n this._lines.push(line);\n if (this._maxLines > 0 && this._lines.length > this._maxLines) {\n const trimmed = this._lines.length - this._maxLines;\n this._lines.splice(0, trimmed);\n this._scrollOffset = Math.max(0, this._scrollOffset - trimmed);\n }\n this._scrollOffset = Math.min(this._scrollOffset, Math.max(0, this._lines.length - 1));\n if (this._autoScroll) {\n this._scrollToBottom();\n }\n this.markDirty();\n }\n\n scrollUp(n = 1): void {\n this._scrollOffset = Math.max(0, this._scrollOffset - n);\n this.markDirty();\n }\n\n scrollDown(n = 1): void {\n const rect = this._getContentRect();\n const visibleLines = Math.max(1, rect.height);\n const maxScroll = Math.max(0, this._lines.length - visibleLines);\n this._scrollOffset = Math.min(\n maxScroll,\n this._scrollOffset + n,\n );\n this.markDirty();\n }\n\n private _scrollToBottom(): void {\n const rect = this._getContentRect();\n const visibleLines = Math.max(1, rect.height);\n this._scrollOffset = Math.max(0, this._lines.length - visibleLines);\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const visibleLines = this._lines.slice(this._scrollOffset, this._scrollOffset + height);\n\n for (let i = 0; i < Math.min(visibleLines.length, height); i++) {\n const line = truncate(visibleLines[i], width);\n const lineColor = this._getLineColor(line);\n\n screen.writeString(x, y + i, line, {\n ...attrs,\n ...(lineColor ? { fg: lineColor } : {}),\n });\n }\n }\n\n private _getLineColor(line: string): Color | null {\n for (const [keyword, color] of Object.entries(this._highlight)) {\n if (line.includes(keyword)) return color;\n }\n return null;\n }\n}\n","import { caps } from '@termuijs/core'\n\nexport type ProgressBarStyle = 'blocks' | 'line' | 'dots'\n\nexport interface ProgressStringProps {\n value: number\n width?: number\n style?: ProgressBarStyle\n color?: string\n showPercent?: boolean\n}\n\nconst UNICODE = { blocks: ['█','░'], line: ['─',' '], dots: ['●','○'] }\nconst ASCII = { blocks: ['#','-'], line: ['-',' '], dots: ['*','.'] }\n\nfunction colorize(text: string, color?: string): string {\n if (!color) return text\n const codes: Record<string,string> = {\n green:'\\x1b[32m', red:'\\x1b[31m', blue:'\\x1b[34m',\n yellow:'\\x1b[33m', cyan:'\\x1b[36m', white:'\\x1b[37m',\n }\n return `${codes[color] ?? ''}${text}\\x1b[0m`\n}\n\nexport const ProgressString = {\n render({ value, width = 40, style = 'blocks', color, showPercent = false }: ProgressStringProps): string {\n const v = Math.max(0, Math.min(100, value))\n const set = caps.unicode ? UNICODE[style] : ASCII[style]\n const barWidth = showPercent ? width - 5 : width\n const filled = Math.round((v / 100) * barWidth)\n const empty = barWidth - filled\n const bar = colorize(set[0].repeat(filled), color) + set[1].repeat(empty)\n const pct = showPercent ? ` ${String(Math.round(v)).padStart(3)}%` : ''\n return `${bar}${pct}`\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Tree widget (collapsible hierarchy)\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n styleToCellAttrs,\n truncate,\n stringWidth,\n caps,\n normalizeNavigationKey,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface TreeNode {\n label: string;\n children?: TreeNode[];\n expanded?: boolean; // default: false\n data?: unknown; // user data attached to node\n}\n\nexport interface TreeOptions {\n nodes: TreeNode[];\n onSelect?: (node: TreeNode, path: number[]) => void;\n indent?: number; // spaces per level, default 2\n}\n\ninterface VisibleEntry {\n node: TreeNode;\n depth: number;\n path: number[];\n}\n\n/**\n * Tree — a collapsible tree widget for displaying hierarchical data.\n *\n * Supports:\n * - Expand/collapse of parent nodes\n * - Keyboard navigation (up/down/left/right, j/k/h/l, home/end)\n * - Enter/Space to toggle or select\n * - onSelect callback for leaf nodes\n * - Unicode and ASCII fallback symbols\n * - Scrolling when tree exceeds visible height\n */\nexport class Tree extends Widget {\n private _nodes: TreeNode[];\n private _onSelect?: (node: TreeNode, path: number[]) => void;\n protected _indent: number;\n protected _selectedIndex = 0;\n protected _scrollOffset = 0;\n protected _visibleNodes: VisibleEntry[] = [];\n\n constructor(options: TreeOptions, style: Partial<Style> = {}) {\n super(style);\n this._nodes = options.nodes;\n this._onSelect = options.onSelect;\n this._indent = options.indent ?? 2;\n this.focusable = true;\n this._buildVisibleNodes();\n }\n\n // ── Public API ─────────────────────────────────────\n\n get selectedIndex(): number { return this._selectedIndex; }\n\n get selectedNode(): TreeNode | undefined {\n return this._visibleNodes[this._selectedIndex]?.node;\n }\n\n setNodes(nodes: TreeNode[]): void {\n this._nodes = nodes;\n this._selectedIndex = 0;\n this._scrollOffset = 0;\n this._buildVisibleNodes();\n this.markDirty();\n }\n\n /** Move cursor up one visible row */\n movePrev(): void {\n if (this._selectedIndex > 0) {\n this._selectedIndex--;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Move cursor down one visible row */\n moveNext(): void {\n if (this._selectedIndex < this._visibleNodes.length - 1) {\n this._selectedIndex++;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Go to first visible node */\n moveFirst(): void {\n this._selectedIndex = 0;\n this._clampScroll();\n this.markDirty();\n }\n\n /** Go to last visible node */\n moveLast(): void {\n if (this._visibleNodes.length > 0) {\n this._selectedIndex = this._visibleNodes.length - 1;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Expand the selected node (if it's a collapsed parent) */\n expand(): void {\n const entry = this._visibleNodes[this._selectedIndex];\n if (!entry) return;\n const node = entry.node;\n if (_isParent(node) && !node.expanded) {\n node.expanded = true;\n this._buildVisibleNodes();\n this.markDirty();\n }\n }\n\n /** Collapse the selected node, or move to parent if already collapsed/leaf */\n collapse(): void {\n const entry = this._visibleNodes[this._selectedIndex];\n if (!entry) return;\n const node = entry.node;\n\n if (_isParent(node) && node.expanded) {\n // Collapse current node\n node.expanded = false;\n this._buildVisibleNodes();\n this._clampScroll();\n this.markDirty();\n } else if (entry.depth > 0) {\n // Move to parent\n const parentPath = entry.path.slice(0, -1);\n const parentIdx = this._visibleNodes.findIndex(\n e => _pathsEqual(e.path, parentPath),\n );\n if (parentIdx >= 0) {\n this._selectedIndex = parentIdx;\n this._clampScroll();\n this.markDirty();\n }\n }\n }\n\n /** Toggle expand/collapse (parent) or call onSelect (leaf) */\n toggle(): void {\n const entry = this._visibleNodes[this._selectedIndex];\n if (!entry) return;\n const node = entry.node;\n\n if (_isParent(node)) {\n node.expanded = !node.expanded;\n this._buildVisibleNodes();\n this._clampScroll();\n this.markDirty();\n } else {\n // Leaf — call onSelect\n this._onSelect?.(node, entry.path);\n }\n }\n\n /**\n * Handle a key event. Call this from your app's key-routing logic\n * when this widget is focused.\n */\n handleKey(key: string): void {\n const normalized = normalizeNavigationKey(key.toLowerCase());\n switch (normalized) {\n case 'arrowup':\n case 'up':\n this.movePrev();\n break;\n case 'arrowdown':\n case 'down':\n this.moveNext();\n break;\n case 'enter':\n case ' ':\n case 'space':\n this.toggle();\n break;\n case 'arrowleft':\n case 'left':\n this.collapse();\n break;\n case 'arrowright':\n case 'right':\n this.expand();\n break;\n case 'home':\n this.moveFirst();\n break;\n case 'end':\n this.moveLast();\n break;\n }\n }\n\n // ── Rendering ──────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const useUnicode = caps.unicode;\n\n const collapsedChevron = useUnicode ? '▶ ' : '> ';\n const expandedChevron = useUnicode ? '▼ ' : 'v ';\n const leafPrefix = useUnicode ? '• ' : '* ';\n\n const visibleCount = Math.min(\n this._visibleNodes.length - this._scrollOffset,\n height,\n );\n\n for (let i = 0; i < visibleCount; i++) {\n const entryIdx = this._scrollOffset + i;\n const entry = this._visibleNodes[entryIdx];\n const { node, depth } = entry;\n const isSelected = entryIdx === this._selectedIndex;\n\n // Build line text\n const indentStr = ' '.repeat(this._indent * depth);\n let chevron: string;\n if (_isParent(node)) {\n chevron = node.expanded ? expandedChevron : collapsedChevron;\n } else {\n chevron = leafPrefix;\n }\n let line = indentStr + chevron + node.label;\n line = truncate(line, width);\n\n // Cell style for selected row\n const cellStyle = isSelected && this.isFocused\n ? {\n ...attrs,\n bg: { type: 'named' as const, name: 'blue' as const },\n bold: true,\n }\n : isSelected\n ? { ...attrs, bold: true }\n : attrs;\n\n screen.writeString(x, y + i, line, cellStyle);\n\n // Fill rest of row for selection highlight\n if (isSelected && this.isFocused) {\n const lineWidth = stringWidth(line);\n const remaining = width - lineWidth;\n for (let c = 0; c < remaining; c++) {\n screen.setCell(x + lineWidth + c, y + i, {\n char: ' ',\n ...cellStyle,\n });\n }\n }\n }\n }\n\n // ── Private helpers ────────────────────────────────\n\n /** Rebuild the flat visible-node list from the tree */\n private _buildVisibleNodes(): void {\n this._visibleNodes = [];\n _collectVisible(this._nodes, 0, [], this._visibleNodes);\n }\n\n /** Ensure scroll keeps the selected index in view */\n private _clampScroll(): void {\n const rect = this._getContentRect();\n const visibleHeight = rect.height > 0 ? rect.height : 24; // fallback for zero-rect\n\n if (this._selectedIndex < this._scrollOffset) {\n this._scrollOffset = this._selectedIndex;\n }\n if (this._selectedIndex >= this._scrollOffset + visibleHeight) {\n this._scrollOffset = this._selectedIndex - visibleHeight + 1;\n }\n this._scrollOffset = Math.max(0, this._scrollOffset);\n }\n}\n\n// ── Module-level helpers ───────────────────────────────\n\nfunction _isParent(node: TreeNode): boolean {\n return Array.isArray(node.children) && node.children.length > 0;\n}\n\nfunction _pathsEqual(a: number[], b: number[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction _collectVisible(\n nodes: TreeNode[],\n depth: number,\n parentPath: number[],\n out: VisibleEntry[],\n): void {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n const path = [...parentPath, i];\n out.push({ node, depth, path });\n if (_isParent(node) && node.expanded) {\n _collectVisible(node.children!, depth + 1, path, out);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — JSONView widget (syntax-colored JSON tree)\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type Color,\n styleToCellAttrs,\n truncate,\n stringWidth,\n caps,\n} from '@termuijs/core';\nimport { Tree, type TreeNode } from './Tree.js';\n\n// ── Type metadata stored in node.data ─────────────────\n\nexport type JSONNodeType =\n | 'null'\n | 'boolean'\n | 'number'\n | 'string'\n | 'array'\n | 'object'\n | 'unknown';\n\nexport interface JSONNodeData {\n type: JSONNodeType;\n /** Original key (if any) that prefixes the label */\n key?: string;\n /** Raw primitive value (for non-container nodes) */\n value?: unknown;\n}\n\n// ── Options ───────────────────────────────────────────\n\nexport interface JSONViewOptions {\n /** The JSON value to display */\n data: unknown;\n /** Callback when a leaf node is selected */\n onSelect?: (node: TreeNode, path: number[]) => void;\n /** Spaces per indent level (default: 2) */\n indent?: number;\n}\n\n// ── jsonToTree() helper ────────────────────────────────\n\n/**\n * Convert any JSON-compatible value to a TreeNode, optionally prefixed\n * by `key` (the property name or array index in the parent container).\n */\nexport function jsonToTree(value: unknown, key?: string): TreeNode {\n const prefix = key !== undefined ? `${key}: ` : '';\n\n if (value === null) {\n return {\n label: `${prefix}null`,\n data: { type: 'null', key } satisfies JSONNodeData,\n };\n }\n\n if (typeof value === 'boolean') {\n return {\n label: `${prefix}${value}`,\n data: { type: 'boolean', key, value } satisfies JSONNodeData,\n };\n }\n\n if (typeof value === 'number') {\n return {\n label: `${prefix}${value}`,\n data: { type: 'number', key, value } satisfies JSONNodeData,\n };\n }\n\n if (typeof value === 'string') {\n return {\n label: `${prefix}\"${value}\"`,\n data: { type: 'string', key, value } satisfies JSONNodeData,\n };\n }\n\n if (Array.isArray(value)) {\n const children = value.map((v, i) => jsonToTree(v, String(i)));\n return {\n label: `${prefix}[${children.length}]`,\n children,\n expanded: false,\n data: { type: 'array', key } satisfies JSONNodeData,\n };\n }\n\n if (typeof value === 'object') {\n const obj = value as Record<string, unknown>;\n const children = Object.keys(obj).map(k => jsonToTree(obj[k], k));\n return {\n label: `${prefix}{${children.length}}`,\n children,\n expanded: false,\n data: { type: 'object', key } satisfies JSONNodeData,\n };\n }\n\n return {\n label: `${prefix}${String(value)}`,\n data: { type: 'unknown', key } satisfies JSONNodeData,\n };\n}\n\n// ── Color helpers ──────────────────────────────────────\n\n/** Pick the foreground color for the value part based on JSON type. */\nfunction _valueColor(type: JSONNodeType): Color {\n switch (type) {\n case 'string': return { type: 'named', name: 'green' };\n case 'number': return { type: 'named', name: 'yellow' };\n case 'boolean': return { type: 'named', name: 'magenta' };\n case 'null': return { type: 'named', name: 'magenta' };\n default: return { type: 'named', name: 'white' };\n }\n}\n\nconst KEY_COLOR: Color = { type: 'named', name: 'cyan' };\n\n/**\n * Split a label produced by jsonToTree into its key prefix and value parts.\n * e.g. `\"name: \\\"Alice\\\"\"` → `{ keyPart: \"name: \", valuePart: \"\\\"Alice\\\"\" }`\n * e.g. `\"null\"` → `{ keyPart: \"\", valuePart: \"null\" }`\n */\nfunction _splitLabel(label: string, nodeData: JSONNodeData): { keyPart: string; valuePart: string } {\n if (nodeData.key !== undefined) {\n const sep = `${nodeData.key}: `;\n if (label.startsWith(sep)) {\n return { keyPart: sep, valuePart: label.slice(sep.length) };\n }\n }\n return { keyPart: '', valuePart: label };\n}\n\n// ── JSONView ───────────────────────────────────────────\n\n/**\n * JSONView — a syntax-colored, collapsible JSON viewer.\n *\n * Extends `Tree` and overrides `_renderSelf` to colorize each row:\n * - Key portion (the `\"key: \"` prefix) is rendered in cyan\n * - Value portion is colored by JSON type:\n * - string → green\n * - number → yellow\n * - boolean / null → magenta\n * - object `{n}` / array `[n]` → white (default)\n *\n * Usage:\n * ```ts\n * const view = new JSONView({ data: { name: 'Alice', age: 30 } });\n * view.updateRect({ x: 0, y: 0, width: 60, height: 20 });\n * view.render(screen);\n * ```\n */\nexport class JSONView extends Tree {\n constructor(options: JSONViewOptions, style: Partial<Style> = {}) {\n const root = jsonToTree(options.data);\n // If the root is a container, use its children as top-level nodes;\n // otherwise wrap the single node in an array.\n const nodes = root.children && root.children.length > 0 ? root.children : [root];\n super({ nodes, onSelect: options.onSelect, indent: options.indent }, style);\n }\n\n // ── Override rendering ─────────────────────────────\n\n /**\n * Replicate Tree's _renderSelf but colorize key/value segments.\n * We access the private state via `(this as any)` since Tree doesn't\n * expose those fields publicly — the tradeoff of extending vs composing.\n */\n protected override _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const useUnicode = caps.unicode;\n\n const collapsedChevron = useUnicode ? '▶ ' : '> ';\n const expandedChevron = useUnicode ? '▼ ' : 'v ';\n const leafPrefix = useUnicode ? '• ' : '* ';\n\n // Access Tree's protected fields directly\n const visibleNodes = this._visibleNodes;\n const scrollOffset = this._scrollOffset;\n const selectedIndex = this._selectedIndex;\n const indent = this._indent;\n\n const visibleCount = Math.min(\n visibleNodes.length - scrollOffset,\n height,\n );\n\n for (let i = 0; i < visibleCount; i++) {\n const entryIdx = scrollOffset + i;\n const entry = visibleNodes[entryIdx];\n const { node, depth } = entry;\n const isSelected = entryIdx === selectedIndex;\n const nodeData = (node.data ?? { type: 'unknown' }) as JSONNodeData;\n\n // Build the prefix (indent + chevron/bullet)\n const indentStr = ' '.repeat(indent * depth);\n const isParent = Array.isArray(node.children) && node.children.length > 0;\n let chevron: string;\n if (isParent) {\n chevron = node.expanded ? expandedChevron : collapsedChevron;\n } else {\n chevron = leafPrefix;\n }\n const linePrefix = indentStr + chevron;\n\n // Split label into key part and value part for colorization\n const { keyPart, valuePart } = _splitLabel(node.label, nodeData);\n\n // Base cell attrs (selection highlight)\n const baseCellStyle = isSelected && this.isFocused\n ? {\n ...attrs,\n bg: { type: 'named' as const, name: 'blue' as const },\n bold: true,\n }\n : isSelected\n ? { ...attrs, bold: true }\n : attrs;\n\n // Write the prefix (indent + chevron) in base style\n let cursorX = x;\n const prefixTrunc = truncate(linePrefix, width);\n if (prefixTrunc.length > 0) {\n screen.writeString(cursorX, y + i, prefixTrunc, baseCellStyle);\n cursorX += stringWidth(prefixTrunc);\n }\n\n const remaining = width - (cursorX - x);\n if (remaining <= 0) {\n _fillSelection(screen, x, y + i, width, cursorX - x, isSelected, this.isFocused, baseCellStyle);\n continue;\n }\n\n // Write key part in cyan\n if (keyPart.length > 0) {\n const keyTrunc = truncate(keyPart, remaining);\n const keyStyle = { ...baseCellStyle, fg: KEY_COLOR };\n screen.writeString(cursorX, y + i, keyTrunc, keyStyle);\n cursorX += stringWidth(keyTrunc);\n }\n\n const remaining2 = width - (cursorX - x);\n if (remaining2 <= 0) {\n _fillSelection(screen, x, y + i, width, cursorX - x, isSelected, this.isFocused, baseCellStyle);\n continue;\n }\n\n // Write value part colored by JSON type\n if (valuePart.length > 0) {\n const valTrunc = truncate(valuePart, remaining2);\n const valColor = _valueColor(nodeData.type);\n const valStyle = { ...baseCellStyle, fg: valColor };\n screen.writeString(cursorX, y + i, valTrunc, valStyle);\n cursorX += stringWidth(valTrunc);\n }\n\n // Fill remainder of row for selection highlight background\n _fillSelection(screen, x, y + i, width, cursorX - x, isSelected, this.isFocused, baseCellStyle);\n }\n }\n}\n\n// ── Module-level render helpers ────────────────────────\n\n/** Fill trailing cells on a selected+focused row for solid highlight background. */\nfunction _fillSelection(\n screen: Screen,\n rowX: number,\n rowY: number,\n width: number,\n writtenWidth: number,\n isSelected: boolean,\n isFocused: boolean,\n cellStyle: Record<string, unknown>,\n): void {\n if (!isSelected || !isFocused) return;\n const remaining = width - writtenWidth;\n for (let c = 0; c < remaining; c++) {\n screen.setCell(rowX + writtenWidth + c, rowY, {\n char: ' ',\n ...cellStyle,\n });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — DiffView widget (unified diff viewer)\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n styleToCellAttrs,\n stringWidth,\n truncate,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface DiffLine {\n type: 'add' | 'remove' | 'context';\n content: string;\n lineNo?: number; // optional line number to show in gutter\n}\n\nexport interface DiffViewOptions {\n lines: DiffLine[];\n showLineNumbers?: boolean; // default: true\n gutterWidth?: number; // default: 5 (e.g. \" 123 \")\n}\n\n/**\n * DiffView — a scrollable unified diff viewer with +/- line coloring.\n *\n * Supports:\n * - Gutter with optional right-aligned line numbers (dim)\n * - '+' prefix for added lines (green fg)\n * - '-' prefix for removed lines (red fg)\n * - ' ' prefix for context lines (dim fg)\n * - Keyboard scrolling: ArrowUp/Down, j/k, PageUp/PageDown, Home/End\n */\nexport class DiffView extends Widget {\n private _lines: DiffLine[];\n private _scrollOffset = 0;\n private _showLineNumbers: boolean;\n private _gutterWidth: number;\n\n constructor(options: DiffViewOptions, style: Partial<Style> = {}) {\n super(style);\n this._lines = options.lines;\n this._showLineNumbers = options.showLineNumbers ?? true;\n this._gutterWidth = options.gutterWidth ?? 5;\n this.focusable = true;\n }\n\n setLines(lines: DiffLine[]): void {\n this._lines = lines;\n this._scrollOffset = 0;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const baseAttrs = styleToCellAttrs(this._style);\n const visibleLines = this._lines.slice(\n this._scrollOffset,\n this._scrollOffset + height,\n );\n\n for (let i = 0; i < visibleLines.length; i++) {\n const diffLine = visibleLines[i];\n let col = x;\n const row = y + i;\n\n // ── Determine color by type ────────────────────────\n const isAdd = diffLine.type === 'add';\n const isRemove = diffLine.type === 'remove';\n const isContext = diffLine.type === 'context';\n\n const fg = isAdd\n ? { type: 'named' as const, name: 'green' as const }\n : isRemove\n ? { type: 'named' as const, name: 'red' as const }\n : undefined;\n\n const lineAttrs = {\n ...baseAttrs,\n ...(fg ? { fg } : {}),\n dim: isContext,\n };\n\n // ── Gutter ─────────────────────────────────────────\n if (this._showLineNumbers) {\n const gutterStr =\n diffLine.lineNo !== undefined\n ? String(diffLine.lineNo).padStart(this._gutterWidth - 1, ' ') + ' '\n : ' '.repeat(this._gutterWidth);\n\n const gutterAttrs = { ...baseAttrs, dim: true };\n screen.writeString(col, row, gutterStr.slice(0, this._gutterWidth), gutterAttrs);\n col += this._gutterWidth;\n }\n\n // ── Prefix character ───────────────────────────────\n const prefix = isAdd ? '+' : isRemove ? '-' : ' ';\n const remainingWidth = width - (col - x);\n if (remainingWidth <= 0) continue;\n\n screen.writeString(col, row, prefix, lineAttrs);\n col += 1;\n\n // ── Content ────────────────────────────────────────\n const contentWidth = width - (col - x);\n if (contentWidth <= 0) continue;\n\n const content = truncate(diffLine.content, contentWidth);\n screen.writeString(col, row, content, lineAttrs);\n }\n }\n\n handleKey(key: string): void {\n const rect = this._getContentRect();\n const visibleHeight = Math.max(1, rect.height);\n const maxOffset = Math.max(0, this._lines.length - visibleHeight);\n\n switch (key) {\n case 'up':\n case 'k':\n this._scrollOffset = Math.max(0, this._scrollOffset - 1);\n this.markDirty();\n break;\n\n case 'down':\n case 'j':\n this._scrollOffset = Math.min(maxOffset, this._scrollOffset + 1);\n this.markDirty();\n break;\n\n case 'pageup':\n this._scrollOffset = Math.max(0, this._scrollOffset - visibleHeight);\n this.markDirty();\n break;\n\n case 'pagedown':\n this._scrollOffset = Math.min(maxOffset, this._scrollOffset + visibleHeight);\n this.markDirty();\n break;\n\n case 'home':\n this._scrollOffset = 0;\n this.markDirty();\n break;\n\n case 'end':\n this._scrollOffset = maxOffset;\n this.markDirty();\n break;\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — StreamingText widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, wordWrap, caps, prefersReducedMotion } from '@termuijs/core';\nimport { timerPoolSubscribe } from '@termuijs/motion';\nimport { Widget } from '../base/Widget.js';\n\nexport interface StreamingTextOptions {\n /** Full text content */\n text: string;\n /** Cursor character. Default: '▋' */\n cursor?: string;\n /** Characters to reveal per tick (0 = show all immediately). Default: 0 */\n speed?: number;\n /** Cursor blink interval in ms. Default: 530 */\n blinkInterval?: number;\n}\n\nconst segmenter = new Intl.Segmenter();\n\n/**\n * StreamingText — renders text that \"streams in\" token by token with a blinking cursor.\n *\n * Useful for displaying AI response streams or typewriter-style text effects.\n *\n * - When `speed === 0`: shows full text immediately, cursor blinks at end.\n * - When `speed > 0`: reveals `speed` chars per `tick()` call until complete.\n * - Cursor blinks every `blinkInterval` ms via the shared timer pool.\n */\nexport class StreamingText extends Widget {\n private _text: string;\n private _cursor: string;\n private _speed: number;\n private _blinkInterval: number;\n /** Number of characters currently revealed (used when speed > 0) */\n private _revealed: number;\n private _cursorVisible: boolean;\n private _blinkUnsub?: () => void;\n\n constructor(options: StreamingTextOptions, style: Partial<Style> = {}) {\n super(style);\n this._text = options.text;\n this._cursor = options.cursor ?? (caps.unicode ? '▋' : '_');\n this._speed = options.speed ?? 0;\n this._blinkInterval = options.blinkInterval ?? 530;\n this._revealed = 0;\n this._cursorVisible = true;\n }\n\n /** Replace text content and reset the revealed counter to 0. */\n setText(text: string): void {\n if (text === this._text) return;\n this._text = text;\n this._revealed = 0;\n this.markDirty();\n }\n\n /**\n * Advance `_revealed` by `speed` characters.\n * Call this from an external tick/render loop when `speed > 0`.\n */\n tick(): void {\n if (this._speed <= 0 || this.isComplete()) return;\n const len = Array.from(segmenter.segment(this._text)).length;\n this._revealed = Math.min(this._revealed + this._speed, len);\n this.markDirty();\n }\n\n /** Returns true when all text has been revealed. */\n isComplete(): boolean {\n if (this._speed === 0) return true;\n const len = Array.from(segmenter.segment(this._text)).length;\n return this._revealed >= len;\n }\n\n /** Lifecycle: start the blink timer (only when motion is enabled). */\n mount(): void {\n super.mount();\n if (prefersReducedMotion()) {\n this._cursorVisible = false; // Don't show cursor in reduced-motion\n return;\n }\n this._blinkUnsub = timerPoolSubscribe(this._blinkInterval, () => {\n this._cursorVisible = !this._cursorVisible;\n this.markDirty();\n });\n }\n\n /** Lifecycle: stop the blink timer. */\n unmount(): void {\n this._blinkUnsub?.();\n this._blinkUnsub = undefined;\n super.unmount();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Determine how much text to display\n const segments = Array.from(segmenter.segment(this._text));\n const displayText = this._speed > 0\n ? segments.slice(0, this._revealed).map(s => s.segment).join('')\n : this._text;\n\n // Append cursor if visible\n const fullText = this._cursorVisible\n ? displayText + this._cursor\n : displayText;\n\n // Word-wrap to fit within content width\n const wrapped = wordWrap(fullText, width);\n const lines = wrapped.split('\\n');\n\n // Render up to rect.height lines\n const limit = Math.min(lines.length, height);\n for (let i = 0; i < limit; i++) {\n const line = lines[i];\n if (line === undefined) continue;\n screen.writeString(x, y + i, line, attrs);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ChatMessage widget\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type NamedColor,\n styleToCellAttrs,\n stringWidth,\n truncate,\n wordWrap,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type MessageRole = 'user' | 'assistant' | 'system' | 'tool';\n\nexport interface ChatMessageOptions {\n role: MessageRole;\n content: string;\n timestamp?: Date;\n}\n\n// ── Role configuration ────────────────────────────────\n\nconst ROLE_CONFIG: Record<MessageRole, { badge: string; colorName: string }> = {\n user: { badge: '[User]', colorName: 'cyan' },\n assistant: { badge: '[Assistant]', colorName: 'green' },\n system: { badge: '[System]', colorName: 'yellow' },\n tool: { badge: '[Tool]', colorName: 'magenta' },\n};\n\n// ── ChatMessage widget ────────────────────────────────\n\n/**\n * ChatMessage — displays a single chat message with a colored role badge\n * and word-wrapped content text.\n *\n * Layout:\n * Row 0: [Role badge] (colored) optional timestamp (dim, right-aligned)\n * Row 1..N: content text, word-wrapped, indented 2 spaces\n */\nexport class ChatMessage extends Widget {\n private _role: MessageRole;\n private _content: string;\n private _timestamp?: Date;\n\n constructor(options: ChatMessageOptions, style: Partial<Style> = {}) {\n super(style);\n this._role = options.role;\n this._content = options.content;\n this._timestamp = options.timestamp;\n this.focusable = false;\n }\n\n /** Update the message content and mark dirty. */\n setContent(content: string): void {\n if (this._content === content) return; \n this._content = content;\n this.markDirty();\n }\n\n /** Update the message role and mark dirty. */\n setRole(role: MessageRole): void {\n if (this._role === role) return;\n this._role = role;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const config = ROLE_CONFIG[this._role];\n const baseAttrs = styleToCellAttrs(this._style);\n\n // ── Row 0: badge + optional timestamp ────────────\n const badgeAttrs = {\n ...baseAttrs,\n fg: { type: 'named' as const, name: config.colorName as NamedColor },\n };\n screen.writeString(x, y, config.badge, badgeAttrs);\n\n if (this._timestamp) {\n const ts = this._timestamp.toLocaleTimeString('en-GB', {\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: false,\n });\n const tsWidth = stringWidth(ts);\n const tsX = x + width - tsWidth;\n // Only draw if it fits without overlapping the badge\n if (tsX > x + stringWidth(config.badge)) {\n const dimAttrs = { ...baseAttrs, dim: true };\n screen.writeString(tsX, y, ts, dimAttrs);\n }\n }\n\n // ── Rows 1..N: content text ───────────────────────\n if (height <= 1) return;\n\n const indent = ' ';\n const contentWidth = Math.max(0, width - indent.length);\n const lines = contentWidth > 0 ? wordWrap(this._content, contentWidth).split('\\n') : [];\n const maxContentRows = height - 1;\n\n for (let i = 0; i < Math.min(lines.length, maxContentRows); i++) {\n const line = lines[i];\n if (line === undefined) continue;\n const displayLine = truncate(indent + line, width);\n screen.writeString(x, y + 1 + i, displayLine, baseAttrs);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ToolCall and ToolApproval widgets\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type NamedColor,\n styleToCellAttrs,\n truncate,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n// ── Types ─────────────────────────────────────────────\n\nexport type ToolCallStatus = 'pending' | 'running' | 'done' | 'error';\n\nexport interface ToolCallOptions {\n name: string;\n args: Record<string, unknown>;\n result?: unknown;\n status: ToolCallStatus;\n collapsed?: boolean; // default: true\n}\n\nexport interface ToolApprovalOptions extends ToolCallOptions {\n onApprove?: () => void;\n onDeny?: () => void;\n}\n\n// ── Status configuration ──────────────────────────────\n\ninterface StatusConfig {\n unicodeSymbol: string;\n asciiSymbol: string;\n colorName: string;\n bold?: boolean;\n dim?: boolean;\n}\n\nconst STATUS_CONFIG: Record<ToolCallStatus, StatusConfig> = {\n pending: { unicodeSymbol: '◌', asciiSymbol: '?', colorName: 'white', dim: true },\n running: { unicodeSymbol: '◎', asciiSymbol: '~', colorName: 'yellow' },\n done: { unicodeSymbol: '✓', asciiSymbol: '+', colorName: 'green' },\n error: { unicodeSymbol: '✗', asciiSymbol: '!', colorName: 'red' },\n};\n\n// ── ToolCall widget ───────────────────────────────────\n\n/**\n * ToolCall — displays an AI tool invocation with status indicator,\n * tool name, arguments, and optional result.\n *\n * Layout (expanded):\n * Row 0: ▶/▼ tool_name [status-symbol] [status-label]\n * Row 1+: \" arg: value\" (one per arg, 2-space indent)\n * (if done/error and result present): \" result: ...\"\n *\n * Space or Enter toggles collapsed/expanded state.\n */\nexport class ToolCall extends Widget {\n protected _name: string;\n protected _args: Record<string, unknown>;\n protected _result: unknown;\n protected _status: ToolCallStatus;\n protected _collapsed: boolean;\n\n constructor(options: ToolCallOptions, style: Partial<Style> = {}) {\n super(style);\n this._name = options.name;\n this._args = options.args;\n this._result = options.result;\n this._status = options.status;\n this._collapsed = options.collapsed ?? true;\n this.focusable = true;\n }\n\n // ── Public API ─────────────────────────────────────\n\n setStatus(status: ToolCallStatus): void {\n this._status = status;\n this.markDirty();\n }\n\n setResult(result: unknown): void {\n this._result = result;\n this.markDirty();\n }\n\n collapse(): void {\n this._collapsed = true;\n this.markDirty();\n }\n\n expand(): void {\n this._collapsed = false;\n this.markDirty();\n }\n\n handleKey(key: string): void {\n if (key === ' ' || key === 'enter') {\n this._collapsed = !this._collapsed;\n this.markDirty();\n }\n }\n\n // ── Rendering ──────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const useUnicode = caps.unicode;\n const baseAttrs = styleToCellAttrs(this._style);\n const config = STATUS_CONFIG[this._status];\n\n // ── Row 0: chevron + name + status ────────────────\n const collapsedChevron = useUnicode ? '▶' : '>';\n const expandedChevron = useUnicode ? '▼' : 'v';\n const chevron = this._collapsed ? collapsedChevron : expandedChevron;\n const symbol = useUnicode ? config.unicodeSymbol : config.asciiSymbol;\n\n const statusAttrs = {\n ...baseAttrs,\n fg: { type: 'named' as const, name: config.colorName as NamedColor },\n bold: config.bold ?? false,\n dim: config.dim ?? false,\n };\n\n // Build header line: \"▶ tool_name [symbol] [status]\"\n const headerText = `${chevron} ${this._name} ${symbol} [${this._status}]`;\n screen.writeString(x, y, truncate(headerText, width), baseAttrs);\n\n // Colorize the status symbol within the header\n const symbolOffset = chevron.length + 1 + this._name.length + 1;\n if (symbolOffset < width) {\n screen.writeString(x + symbolOffset, y, symbol, statusAttrs);\n }\n\n if (this._collapsed) return;\n\n // ── Rows 1+: args ─────────────────────────────────\n let row = 1;\n const argEntries = Object.entries(this._args);\n\n for (const [key, value] of argEntries) {\n if (row >= height) break;\n const argLine = ` ${key}: ${JSON.stringify(value)}`;\n screen.writeString(x, y + row, truncate(argLine, width), baseAttrs);\n row++;\n }\n\n // ── Result row (done/error) ───────────────────────\n if (\n row < height &&\n this._result !== undefined &&\n (this._status === 'done' || this._status === 'error')\n ) {\n const resultStr = typeof this._result === 'string'\n ? this._result\n : JSON.stringify(this._result);\n const resultLine = ` result: ${resultStr}`;\n screen.writeString(x, y + row, truncate(resultLine, width), baseAttrs);\n }\n }\n}\n\n// ── ToolApproval widget ───────────────────────────────\n\n/**\n * ToolApproval — extends ToolCall with an approval prompt row.\n * When focused, shows \"[y] Approve [n] Deny\" after the args/result.\n * y/Enter calls onApprove; n/Escape calls onDeny.\n */\nexport class ToolApproval extends ToolCall {\n private _onApprove?: () => void;\n private _onDeny?: () => void;\n\n constructor(options: ToolApprovalOptions, style: Partial<Style> = {}) {\n super(options, style);\n this._onApprove = options.onApprove;\n this._onDeny = options.onDeny;\n }\n\n protected _renderSelf(screen: Screen): void {\n // Render the base ToolCall first\n super._renderSelf(screen);\n\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n // Calculate row after the header + args + result\n let rowsUsed = 1; // header row\n if (!this._collapsed) {\n rowsUsed += Object.keys(this._args).length;\n if (\n this._result !== undefined &&\n (this._status === 'done' || this._status === 'error')\n ) {\n rowsUsed += 1;\n }\n }\n\n const approvalRow = y + rowsUsed;\n if (approvalRow >= y + height) return;\n\n const baseAttrs = styleToCellAttrs(this._style);\n\n const approveAttrs = {\n ...baseAttrs,\n fg: { type: 'named' as const, name: 'green' as const },\n bold: true,\n };\n const denyAttrs = {\n ...baseAttrs,\n fg: { type: 'named' as const, name: 'red' as const },\n bold: true,\n };\n\n const approveText = '[y] Approve';\n const denyText = '[n] Deny';\n\n screen.writeString(x, approvalRow, approveText, approveAttrs);\n const denyX = x + approveText.length + 2;\n if (denyX + denyText.length <= x + width) {\n screen.writeString(denyX, approvalRow, denyText, denyAttrs);\n }\n }\n\n handleKey(key: string): void {\n if (key === 'y' || key === 'enter') {\n this._onApprove?.();\n } else if (key === 'n' || key === 'escape') {\n this._onDeny?.();\n } else {\n super.handleKey(key);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Canvas widget\n// ─────────────────────────────────────────────────────\n\nimport type { Screen, Style, Color } from '@termuijs/core';\nimport { styleToCellAttrs, BRAILLE_OFFSET, BRAILLE_DOTS } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * A raw Canvas widget providing a HTML5-like 2D drawing context for custom rendering.\n * Mapped to Braille characters for 2x4 sub-cell pixel resolution.\n */\nexport class Canvas extends Widget {\n private _pixels: Uint8Array;\n private _canvasWidth: number = 0;\n private _canvasHeight: number = 0;\n private _color: Color | undefined;\n\n constructor(style: Partial<Style> = {}) {\n super(style);\n this._pixels = new Uint8Array(0);\n }\n\n /**\n * Sets the active drawing color. If not set, the foreground color from style is used.\n */\n public setColor(color: Color): void {\n this._color = color;\n }\n\n /**\n * Clears the entire canvas.\n */\n public clear(): void {\n if (this._pixels.length > 0) {\n this._pixels.fill(0);\n this.markDirty();\n }\n }\n\n /**\n * Sets a single sub-cell pixel.\n */\n public setPixel(x: number, y: number, value: boolean = true): void {\n x = Math.floor(x);\n y = Math.floor(y);\n if (x < 0 || x >= this._canvasWidth || y < 0 || y >= this._canvasHeight) return;\n \n const idx = y * this._canvasWidth + x;\n const current = this._pixels[idx];\n const next = value ? 1 : 0;\n \n if (current !== next) {\n this._pixels[idx] = next;\n this.markDirty();\n }\n }\n\n /**\n * Fills a rectangle with the current drawing state.\n */\n public fillRect(x: number, y: number, w: number, h: number): void {\n x = Math.floor(x);\n y = Math.floor(y);\n w = Math.floor(w);\n h = Math.floor(h);\n\n let dirty = false;\n for (let r = Math.max(0, y); r < Math.min(this._canvasHeight, y + h); r++) {\n for (let c = Math.max(0, x); c < Math.min(this._canvasWidth, x + w); c++) {\n const idx = r * this._canvasWidth + c;\n if (this._pixels[idx] !== 1) {\n this._pixels[idx] = 1;\n dirty = true;\n }\n }\n }\n if (dirty) {\n this.markDirty();\n }\n }\n\n /**\n * Draws an unfilled circle.\n */\n public drawCircle(cx: number, cy: number, r: number): void {\n cx = Math.floor(cx);\n cy = Math.floor(cy);\n r = Math.floor(r);\n\n // Bresenham's circle algorithm\n let x = 0;\n let y = r;\n let d = 3 - 2 * r;\n \n const drawCirclePixels = (xc: number, yc: number, x: number, y: number) => {\n this.setPixel(xc + x, yc + y);\n this.setPixel(xc - x, yc + y);\n this.setPixel(xc + x, yc - y);\n this.setPixel(xc - x, yc - y);\n this.setPixel(xc + y, yc + x);\n this.setPixel(xc - y, yc + x);\n this.setPixel(xc + y, yc - x);\n this.setPixel(xc - y, yc - x);\n };\n\n drawCirclePixels(cx, cy, x, y);\n while (y >= x) {\n x++;\n if (d > 0) {\n y--;\n d = d + 4 * (x - y) + 10;\n } else {\n d = d + 4 * x + 6;\n }\n drawCirclePixels(cx, cy, x, y);\n }\n }\n\n /**\n * Draws a line from (x0, y0) to (x1, y1).\n */\n public lineTo(x0: number, y0: number, x1: number, y1: number): void {\n x0 = Math.floor(x0);\n y0 = Math.floor(y0);\n x1 = Math.floor(x1);\n y1 = Math.floor(y1);\n\n const dx = Math.abs(x1 - x0);\n const dy = -Math.abs(y1 - y0);\n const sx = x0 < x1 ? 1 : -1;\n const sy = y0 < y1 ? 1 : -1;\n let err = dx + dy;\n\n while (true) {\n this.setPixel(x0, y0);\n if (x0 === x1 && y0 === y1) break;\n const e2 = 2 * err;\n if (e2 >= dy) {\n err += dy;\n x0 += sx;\n }\n if (e2 <= dx) {\n err += dx;\n y0 += sy;\n }\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n const border = this._style.border && this._style.border !== 'none' ? 1 : 0;\n \n const innerWidth = width - border * 2;\n const innerHeight = height - border * 2;\n\n if (innerWidth <= 0 || innerHeight <= 0) {\n return;\n }\n\n const pxWidth = innerWidth * 2;\n const pxHeight = innerHeight * 4;\n\n if (this._canvasWidth !== pxWidth || this._canvasHeight !== pxHeight) {\n const newPixels = new Uint8Array(pxWidth * pxHeight);\n \n // Optionally preserve old pixels if resizing\n for (let r = 0; r < Math.min(this._canvasHeight, pxHeight); r++) {\n for (let c = 0; c < Math.min(this._canvasWidth, pxWidth); c++) {\n newPixels[r * pxWidth + c] = this._pixels[r * this._canvasWidth + c];\n }\n }\n\n this._pixels = newPixels;\n this._canvasWidth = pxWidth;\n this._canvasHeight = pxHeight;\n }\n\n const { bg, fg } = styleToCellAttrs(this._style);\n const finalFg = this._color ? this._color : fg;\n\n for (let r = 0; r < innerHeight; r++) {\n for (let c = 0; c < innerWidth; c++) {\n let charCode = BRAILLE_OFFSET;\n let hasPixels = false;\n \n for (let br = 0; br < 4; br++) {\n for (let bc = 0; bc < 2; bc++) {\n const px = c * 2 + bc;\n const py = r * 4 + br;\n if (this._pixels[py * this._canvasWidth + px]) {\n charCode |= BRAILLE_DOTS[br][bc];\n hasPixels = true;\n }\n }\n }\n \n const char = hasPixels ? String.fromCharCode(charCode) : ' ';\n screen.setCell(x + border + c, y + border + r, { char, bg, fg: finalFg });\n }\n }\n }\n}\n","// -----------------------------------------------------------------------------\n// @termuijs/widgets - Rating widget\n// -----------------------------------------------------------------------------\n\nimport { type Screen, type Style, caps, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface RatingOptions {\n value?: number;\n max?: number;\n showLabel?: boolean;\n}\n\n/**\n * Rating - displays a star rating with optional textual feedback.\n */\nexport class Rating extends Widget {\n private _value: number;\n private _max: number;\n private _showLabel: boolean;\n\n constructor(style: Partial<Style> = {}, opts: RatingOptions = {}) {\n super(style);\n\n this._max = Math.max(1, opts.max ?? 5);\n this._value = Math.max(\n 0,\n Math.min(opts.value ?? 0, this._max),\n );\n this._showLabel = opts.showLabel ?? false;\n }\n\n getValue(): number {\n return this._value;\n }\n\n getMax(): number {\n return this._max;\n }\n\n setValue(value: number): void {\n const nextValue = Math.max(\n 0,\n Math.min(value, this._max),\n );\n\n if (this._value === nextValue) return;\n\n this._value = nextValue;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n const filled = caps.unicode ? '★' : '*';\n const empty = caps.unicode ? '☆' : '-';\n\n const stars =\n filled.repeat(this._value) +\n empty.repeat(this._max - this._value);\n\n screen.writeString(\n x,\n y,\n stars.slice(0, width),\n attrs,\n );\n\n if (this._showLabel && height > 1) {\n const label = `Rating: ${this._value} / ${this._max}`;\n\n screen.writeString(\n x,\n y + 1,\n label.slice(0, width),\n attrs,\n );\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Pty widget\n// ─────────────────────────────────────────────────────\n\nimport { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process';\nimport type { Screen, Style, KeyEvent } from '@termuijs/core';\nimport { styleToCellAttrs, stripAnsi, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface PtyOptions {\n /** The command to spawn */\n command?: string;\n /** Arguments to the command */\n args?: string[];\n}\n\n/**\n * Pty — Terminal Multiplexer widget.\n * Spawns a child process and renders its output inside the TermUI screen.\n */\nexport class Pty extends Widget {\n private _process: ChildProcessWithoutNullStreams | null = null;\n private _lines: string[] = [];\n private _autoScroll = true;\n\n constructor(style: Partial<Style> = {}, opts: PtyOptions = {}) {\n super(style);\n \n // Default to a shell if no command is provided\n const cmd = opts.command ?? (process.platform === 'win32' ? 'cmd.exe' : '/bin/sh');\n const args = opts.args ?? [];\n \n try {\n this._process = spawn(cmd, args);\n \n this._process.stdout.on('data', (data) => {\n this._handleOutput(data.toString());\n });\n \n this._process.stderr.on('data', (data) => {\n this._handleOutput(data.toString());\n });\n \n this._process.on('close', () => {\n this._handleOutput('\\n[Process Exited]');\n });\n } catch (err) {\n this._lines.push(`Failed to spawn ${cmd}`);\n }\n }\n\n private _handleOutput(chunk: string): void {\n const clean = stripAnsi(chunk);\n // Normalize carriage returns and split into lines\n const newLines = clean.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n').split('\\n');\n \n if (newLines.length > 0) {\n if (this._lines.length === 0) {\n this._lines.push(newLines[0]);\n } else {\n this._lines[this._lines.length - 1] += newLines[0];\n }\n \n for (let i = 1; i < newLines.length; i++) {\n this._lines.push(newLines[i]);\n }\n }\n \n // Keep a reasonable buffer size\n if (this._lines.length > 1000) {\n this._lines = this._lines.slice(this._lines.length - 1000);\n }\n \n this.markDirty();\n }\n\n public handleKey(event: KeyEvent): boolean {\n if (!this._process || !this._process.stdin.writable) return false;\n \n this._process.stdin.write(event.raw);\n return true;\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n \n // Render from bottom up or top down depending on scroll\n const startIdx = Math.max(0, this._lines.length - height);\n const visibleLines = this._lines.slice(startIdx, startIdx + height);\n \n for (let i = 0; i < visibleLines.length; i++) {\n // Note: truncate from unicode utils properly handles wide characters\n const line = truncate(visibleLines[i], width);\n screen.writeString(x, y + i, line, attrs);\n }\n }\n \n /**\n * Terminate the spawned process\n */\n public destroy(): void {\n if (this._process) {\n this._process.kill();\n this._process = null;\n }\n }\n}\n","export interface ScrollRange {\n start: number; // first item index to render\n end: number; // one past last item index to render (exclusive)\n offsetPx: number; // scroll offset in pixels (for variable height)\n}\n\n/**\n * Compute visible range for fixed-height items.\n * @param scrollOffset - first visible item index (scroll position in items, NOT pixels)\n * @param viewportItems - number of items visible in the viewport\n * @param itemCount - total number of items\n * @param overscan - extra items to render beyond viewport edges (default: 2)\n */\nexport function computeRange(\n scrollOffset: number,\n viewportItems: number,\n itemCount: number,\n overscan = 2,\n): ScrollRange {\n const start = Math.max(0, scrollOffset - overscan);\n const end = Math.min(itemCount, scrollOffset + viewportItems + overscan);\n return { start, end, offsetPx: start };\n}\n\n/**\n * Compute visible range for variable-height items.\n * @param scrollPx - scroll position in pixels\n * @param viewportPx - viewport height in pixels\n * @param sizes - array of item heights in pixels\n * @param overscan - extra items to render (default: 2)\n */\nexport function computeVariableRange(\n scrollPx: number,\n viewportPx: number,\n sizes: number[],\n overscan = 2,\n): ScrollRange {\n const cumulative: number[] = [];\n let sum = 0;\n for (const s of sizes) {\n cumulative.push(sum);\n sum += s;\n }\n cumulative.push(sum); // sentinel\n\n // First item that starts within or before the viewport\n let startIdx = cumulative.findIndex((c, i) => i < sizes.length && c + sizes[i] > scrollPx);\n if (startIdx < 0) startIdx = sizes.length;\n startIdx = Math.max(0, startIdx - overscan);\n\n // Last item that starts before viewport end\n const viewportEnd = scrollPx + viewportPx;\n let endIdx = cumulative.findIndex((c) => c >= viewportEnd);\n if (endIdx < 0) endIdx = sizes.length;\n endIdx = Math.min(sizes.length, endIdx + overscan);\n\n return { start: startIdx, end: endIdx, offsetPx: cumulative[startIdx] };\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — List widget (selectable)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { type ListState } from '../data/ListState.js';\n\nexport interface ListItem {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\nexport interface ListProps {\n items?: ListItem[];\n style?: Partial<Style>;\n onSelect?: (item: ListItem, index: number) => void;\n /** External state object – if provided, List reads/writes selection through it */\n state?: ListState;\n /** Called whenever selection or scroll changes */\n onStateChange?: (state: ListState) => void;\n}\n\n/**\n * List — a scrollable, selectable list of items.\n *\n * Supports:\n * - Keyboard navigation (up/down/Home/End)\n * - Scrolling when items exceed visible height\n * - Custom item styling\n * - Disabled items\n * - External state via `state` prop and `useListState` hook\n */\nexport class List extends Widget {\n private _items: ListItem[];\n private _selectedIndex = 0;\n private _scrollOffset = 0;\n private _onSelect?: (item: ListItem, index: number) => void;\n private _state?: ListState;\n private _onStateChange?: (state: ListState) => void;\n\n constructor(\n itemsOrProps: ListItem[] | ListProps,\n style: Partial<Style> = {},\n onSelect?: (item: ListItem, index: number) => void,\n ) {\n super({ border: 'single', ...style });\n\n if (Array.isArray(itemsOrProps)) {\n this._items = itemsOrProps;\n this._onSelect = onSelect;\n } else {\n const props = itemsOrProps as ListProps;\n this._items = props.items ?? [];\n this._state = props.state;\n this._onStateChange = props.onStateChange;\n this._onSelect = props.onSelect ?? onSelect;\n\n // Initialise from external state if provided\n if (props.state) {\n this._selectedIndex = props.state.selectedIndex;\n this._scrollOffset = props.state.scrollOffset;\n }\n }\n\n this.focusable = true;\n }\n\n // ── Getters ───────────────────────────────────────\n\n get selectedIndex(): number { return this._selectedIndex; }\n get selectedItem(): ListItem | undefined { return this._items[this._selectedIndex]; }\n\n // ── Mutations ─────────────────────────────────────\n\n setItems(items: ListItem[]): void {\n this._items = items;\n if (this._selectedIndex >= items.length) {\n this._selectedIndex = Math.max(0, items.length - 1);\n }\n this._clampScroll();\n this.markDirty();\n this._pushState();\n }\n\n /** Move selection up */\n selectPrev(): void {\n let next = this._selectedIndex - 1;\n while (next >= 0 && this._items[next]?.disabled) next--;\n if (next >= 0) {\n this._selectedIndex = next;\n this._clampScroll();\n this.markDirty();\n this._pushState();\n }\n }\n\n /** Move selection down */\n selectNext(): void {\n let next = this._selectedIndex + 1;\n while (next < this._items.length && this._items[next]?.disabled) next++;\n if (next < this._items.length) {\n this._selectedIndex = next;\n this._clampScroll();\n this.markDirty();\n this._pushState();\n }\n }\n\n /** Confirm the current selection */\n confirm(): void {\n const item = this._items[this._selectedIndex];\n if (item && !item.disabled) {\n this._onSelect?.(item, this._selectedIndex);\n }\n }\n\n // ── External state sync ───────────────────────────\n\n private _pushState(): void {\n if (this._state) {\n this._state.items = this._items;\n this._state.selectedIndex = this._selectedIndex;\n this._state.scrollOffset = this._scrollOffset;\n this._onStateChange?.(this._state);\n }\n }\n\n // ── Rendering ─────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const visibleCount = Math.min(this._items.length - this._scrollOffset, height);\n\n for (let i = 0; i < visibleCount; i++) {\n const itemIdx = this._scrollOffset + i;\n const item = this._items[itemIdx];\n const isSelected = itemIdx === this._selectedIndex;\n\n // Compose the line\n const prefix = isSelected ? (caps.unicode ? '▸ ' : '> ') : ' ';\n let line = prefix + item.label;\n line = truncate(line, width);\n\n // Style\n const cellStyle = {\n ...attrs,\n bold: isSelected,\n dim: item.disabled ?? false,\n inverse: isSelected && this.isFocused,\n };\n\n screen.writeString(x, y + i, line, cellStyle);\n\n // Fill rest of line for inverse highlight\n if (isSelected && this.isFocused) {\n const remaining = width - stringWidth(line);\n for (let c = 0; c < remaining; c++) {\n screen.setCell(x + stringWidth(line) + c, y + i, { char: ' ', ...cellStyle });\n }\n }\n }\n\n // Scrollbar indicator\n if (this._items.length > height) {\n const scrollRatio = this._scrollOffset / (this._items.length - height);\n const scrollPos = Math.floor(scrollRatio * (height - 1));\n for (let r = 0; r < height; r++) {\n const scrollChar = r === scrollPos ? (caps.unicode ? '█' : '#') : (caps.unicode ? '░' : '-');\n screen.setCell(x + width - 1, y + r, { char: scrollChar, ...attrs, dim: true });\n }\n }\n }\n\n private _clampScroll(): void {\n const rect = this._getContentRect();\n const visibleHeight = rect.height;\n if (visibleHeight <= 0) { this._scrollOffset = 0; return; }\n\n if (this._selectedIndex < this._scrollOffset) {\n this._scrollOffset = this._selectedIndex;\n }\n if (this._selectedIndex >= this._scrollOffset + visibleHeight) {\n this._scrollOffset = this._selectedIndex - visibleHeight + 1;\n }\n }\n}\n","// packages/widgets/src/data/ListState.ts\nimport { ListItem } from '../input/List.js';\n\n/**\n * External state object for List widget.\n * It owns the items, selected index and scroll offset.\n * The hook returns the same mutable object that can be passed to <List state={s} />.\n */\nexport interface ListState {\n /** The items displayed by the list */\n items: ListItem[];\n /** Index of the currently selected item */\n selectedIndex: number;\n /** Scroll offset (first visible item index) */\n scrollOffset: number;\n /** Update items */\n setItems(items: ListItem[]): void;\n /** Move selection up */\n selectPrev(): void;\n /** Move selection down */\n selectNext(): void;\n /** Confirm current selection (optional hook) */\n confirm(): void;\n}\n\n/** Hook that creates a fresh ListState. */\nexport function useListState(initial: { items: ListItem[] }): ListState {\n const state: ListState = {\n items: initial.items,\n selectedIndex: 0,\n scrollOffset: 0,\n setItems(items: ListItem[]) {\n state.items = items;\n if (state.selectedIndex >= items.length) {\n state.selectedIndex = Math.max(0, items.length - 1);\n }\n },\n selectPrev() {\n let next = state.selectedIndex - 1;\n while (next >= 0 && state.items[next]?.disabled) next--;\n if (next >= 0) {\n state.selectedIndex = next;\n if (next < state.scrollOffset) {\n state.scrollOffset = next;\n }\n }\n },\n selectNext() {\n let next = state.selectedIndex + 1;\n while (next < state.items.length && state.items[next]?.disabled) next++;\n if (next < state.items.length) {\n state.selectedIndex = next;\n // Note: scroll logic will be handled by List.render when needed\n }\n },\n confirm() {\n // No‑op placeholder – UI can call this when Enter is pressed.\n },\n };\n return state;\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — VirtualList (scroll virtualization)\n//\n// Renders only the visible rows of a large dataset.\n// Supports keyboard navigation, custom item rendering,\n// and variable-height items.\n//\n// Usage:\n// const list = new VirtualList({\n// totalItems: 100_000,\n// itemHeight: 1,\n// renderItem: (index) => `Row #${index}`,\n// });\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, truncate, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { computeRange } from './virtual-scroll.js';\n\nexport interface VirtualListOptions {\n /** Total number of items (the full dataset size) */\n totalItems: number;\n /** Height of each item in rows (default: 1) */\n itemHeight?: number;\n /** Render function: returns the string content for an item at a given index */\n renderItem: (index: number) => string;\n /** Style overrides */\n style?: Partial<Style>;\n /** Callback when an item is selected (Enter key) */\n onSelect?: (index: number) => void;\n /** Number of overscan rows to render above/below the viewport (default: 2) */\n overscan?: number;\n /** Show scrollbar (default: true) */\n showScrollbar?: boolean;\n}\n\n/**\n * VirtualList — a scroll-virtualized list widget.\n *\n * Only renders the items visible in the viewport plus\n * a small overscan buffer, enabling smooth scrolling\n * through datasets of any size.\n *\n * Performance:\n * - 100 items → renders ~26 rows\n * - 1,000,000 items → still renders only ~26 rows\n */\nexport class VirtualList extends Widget {\n private _totalItems: number;\n private _itemHeight: number;\n private _renderItem: (index: number) => string;\n private _onSelect?: (index: number) => void;\n private _selectedIndex = 0;\n private _scrollOffset = 0;\n private _overscan: number;\n private _showScrollbar: boolean;\n\n constructor(options: VirtualListOptions) {\n super({ border: 'single', ...options.style });\n this._totalItems = options.totalItems;\n this._itemHeight = options.itemHeight ?? 1;\n this._renderItem = options.renderItem;\n this._onSelect = options.onSelect;\n this._overscan = options.overscan ?? 2;\n this._showScrollbar = options.showScrollbar ?? true;\n this.focusable = true;\n }\n\n // ── Getters ──\n\n get totalItems(): number { return this._totalItems; }\n get selectedIndex(): number { return this._selectedIndex; }\n get scrollOffset(): number { return this._scrollOffset; }\n\n // ── Public API ──\n\n /** Update the total item count (e.g., after data refresh) */\n setTotalItems(count: number): void {\n this._totalItems = count;\n this._selectedIndex = Math.min(this._selectedIndex, Math.max(0, count - 1));\n this._clampScroll();\n this.markDirty();\n }\n\n /** Update the render function (e.g., when data changes) */\n setRenderItem(fn: (index: number) => string): void {\n this._renderItem = fn;\n this.markDirty();\n }\n\n /** Move selection up by one */\n selectPrev(): void {\n if (this._selectedIndex > 0) {\n this._selectedIndex--;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Move selection down by one */\n selectNext(): void {\n if (this._selectedIndex < this._totalItems - 1) {\n this._selectedIndex++;\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Jump to the first item */\n selectFirst(): void {\n this._selectedIndex = 0;\n this._clampScroll();\n this.markDirty();\n }\n\n /** Jump to the last item */\n selectLast(): void {\n this._selectedIndex = Math.max(0, this._totalItems - 1);\n this._clampScroll();\n this.markDirty();\n }\n\n /** Page up — move by viewport height */\n pageUp(): void {\n const rect = this._getContentRect();\n const pageSize = Math.floor(rect.height / this._itemHeight);\n this._selectedIndex = Math.max(0, this._selectedIndex - pageSize);\n this._clampScroll();\n this.markDirty();\n }\n\n /** Page down — move by viewport height */\n pageDown(): void {\n const rect = this._getContentRect();\n const pageSize = Math.floor(rect.height / this._itemHeight);\n this._selectedIndex = Math.min(this._totalItems - 1, this._selectedIndex + pageSize);\n this._clampScroll();\n this.markDirty();\n }\n\n /** Scroll to a specific index */\n scrollTo(index: number): void {\n this._selectedIndex = Math.max(0, Math.min(index, this._totalItems - 1));\n this._clampScroll();\n this.markDirty();\n }\n\n /** Confirm the current selection */\n confirm(): void {\n if (this._totalItems > 0) {\n this._onSelect?.(this._selectedIndex);\n }\n }\n\n // ── Rendering ──\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._totalItems === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const visibleItemCount = Math.floor(height / this._itemHeight);\n\n // Calculate the visible window with overscan\n const { start: startIdx, end: endIdx } = computeRange(\n this._scrollOffset, visibleItemCount, this._totalItems, this._overscan,\n );\n\n // Content width (leave room for scrollbar)\n const contentWidth = this._showScrollbar && this._totalItems > visibleItemCount\n ? width - 1\n : width;\n\n // Only render items in the visible window\n for (let idx = startIdx; idx < endIdx; idx++) {\n const rowY = y + (idx - this._scrollOffset) * this._itemHeight;\n\n // Skip if outside the visible rect\n if (rowY < y || rowY >= y + height) continue;\n\n const isSelected = idx === this._selectedIndex;\n\n // Get the item content\n let content: string;\n try {\n content = this._renderItem(idx);\n } catch {\n content = `[Error: item ${idx}]`;\n }\n\n // Add selection prefix\n const prefix = isSelected ? (caps.unicode ? '▸ ' : '> ') : ' ';\n let line = prefix + content;\n line = truncate(line, contentWidth);\n\n // Style\n const cellStyle = {\n ...attrs,\n bold: isSelected,\n inverse: isSelected && this.isFocused,\n };\n\n screen.writeString(x, rowY, line, cellStyle);\n\n // Fill rest of line for inverse highlight\n if (isSelected && this.isFocused) {\n const remaining = contentWidth - stringWidth(line);\n for (let c = 0; c < remaining; c++) {\n screen.setCell(x + stringWidth(line) + c, rowY, { char: ' ', ...cellStyle });\n }\n }\n }\n\n // Scrollbar\n if (this._showScrollbar && this._totalItems > visibleItemCount) {\n const scrollbarX = x + width - 1;\n const totalPages = this._totalItems - visibleItemCount;\n const scrollRatio = totalPages > 0 ? this._scrollOffset / totalPages : 0;\n const thumbPos = Math.floor(scrollRatio * (height - 1));\n const thumbChar = caps.unicode ? '█' : '#';\n const trackChar = caps.unicode ? '░' : '|';\n\n for (let r = 0; r < height; r++) {\n const scrollChar = r === thumbPos ? thumbChar : trackChar;\n screen.setCell(scrollbarX, y + r, { char: scrollChar, ...attrs, dim: r !== thumbPos });\n }\n }\n }\n\n // ── Internal ──\n\n private _clampScroll(): void {\n const rect = this._getContentRect();\n const visibleHeight = Math.floor(rect.height / this._itemHeight);\n if (visibleHeight <= 0) { this._scrollOffset = 0; return; }\n\n // Keep selected item visible\n if (this._selectedIndex < this._scrollOffset) {\n this._scrollOffset = this._selectedIndex;\n }\n if (this._selectedIndex >= this._scrollOffset + visibleHeight) {\n this._scrollOffset = this._selectedIndex - visibleHeight + 1;\n }\n\n // Clamp scroll offset\n this._scrollOffset = Math.max(0, Math.min(this._scrollOffset, this._totalItems - visibleHeight));\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — CommandPalette widget\n//\n// A fuzzy-search overlay widget. Shows a floating box\n// with a text input and a filtered list of commands.\n//\n// Usage:\n// const palette = new CommandPalette({\n// commands: [\n// { id: 'open', label: 'Open File', description: 'Ctrl+O', action: () => {} },\n// ],\n// onClose: () => palette.setStyle({ visible: false }),\n// });\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface Command {\n id: string;\n label: string;\n description?: string;\n action: () => void;\n}\n\nexport interface CommandPaletteOptions {\n commands: Command[];\n onClose?: () => void;\n /** Placeholder shown when query is empty. Default: 'Type to search...' */\n placeholder?: string;\n /** Max number of commands shown at once. Default: 8 */\n maxVisible?: number;\n}\n\n/**\n * CommandPalette — a fuzzy-search overlay widget.\n *\n * Renders a floating panel with:\n * - Row 0: `> ` + query text (or placeholder when empty)\n * - Rows 1..N: filtered command list with label + description\n *\n * Key bindings:\n * - Printable chars: append to query\n * - Backspace: delete last query character\n * - ArrowUp / k: move selection up\n * - ArrowDown / j: move selection down\n * - Enter: execute selected command\n * - Escape: call onClose\n */\nexport class CommandPalette extends Widget {\n private _commands: Command[];\n private _filtered: Command[];\n private _query = '';\n private _selectedIndex = 0;\n private _options: CommandPaletteOptions;\n\n constructor(options: CommandPaletteOptions, style: Partial<Style> = {}) {\n super({ border: 'single', ...style });\n this._options = {\n placeholder: 'Type to search...',\n maxVisible: 8,\n ...options,\n };\n this._commands = options.commands;\n this._filtered = [...this._commands];\n this.focusable = true;\n }\n\n /** Update the full command list and re-filter. */\n setCommands(commands: Command[]): void {\n this._commands = commands;\n this._filter();\n this.markDirty();\n }\n\n /**\n * Reset query, re-filter all commands, reset selection.\n * Call this when opening the palette.\n */\n open(): void {\n this._query = '';\n this._selectedIndex = 0;\n this._filtered = [...this._commands];\n this.markDirty();\n }\n\n /** Current query string. */\n getQuery(): string {\n return this._query;\n }\n\n // ─── Private helpers ────────────────────────────────\n\n \n /** Compute a fuzzy-match score for a single text against a query. */\n private _fuzzyScore(text: string, query: string): number {\n text = text.toLowerCase();\n query = query.toLowerCase();\n\n if (text === query) return 1000;\n\n if (text.includes(query)) {\n return 500 - text.indexOf(query);\n }\n\n let score = 0;\n let qi = 0;\n\n for (let i = 0; i < text.length && qi < query.length; i++) {\n if (text[i] === query[qi]) {\n score += 10;\n qi++;\n }\n }\n\n return qi === query.length ? score : -1;\n}\n \n /** Filter commands based on current query (case-insensitive substring). */\n private _filter(): void {\n const q = this._query.toLowerCase();\n\n if (q === '') {\n this._filtered = [...this._commands];\n } else {\n this._filtered = this._commands\n .map((cmd) => ({\n cmd,\n score: Math.max(\n this._fuzzyScore(cmd.label, q),\n this._fuzzyScore(cmd.id, q),\n ),\n }))\n .filter((item) => item.score >= 0)\n .sort((a, b) => b.score - a.score)\n .map((item) => item.cmd);\n }\n\n const max = Math.max(0, this._filtered.length - 1);\n this._selectedIndex = Math.min(this._selectedIndex, max);\n}\n\n private _executeSelected(): void {\n const cmd = this._filtered[this._selectedIndex];\n if (cmd) {\n cmd.action();\n }\n }\n\n private _moveUp(): void {\n if (this._selectedIndex > 0) {\n this._selectedIndex--;\n }\n }\n\n private _moveDown(): void {\n const maxVisible = this._options.maxVisible ?? 8;\n const visibleCount = Math.min(this._filtered.length, maxVisible);\n if (this._selectedIndex < visibleCount - 1) {\n this._selectedIndex++;\n }\n }\n\n // ─── Key handling ────────────────────────────────────\n\n handleKey(key: string): void {\n switch (key) {\n case 'escape':\n this._options.onClose?.();\n break;\n case 'enter':\n this._executeSelected();\n break;\n case 'up':\n case 'k':\n this._moveUp();\n break;\n case 'down':\n case 'j':\n this._moveDown();\n break;\n case 'backspace':\n this._query = this._query.slice(0, -1);\n this._filter();\n break;\n default:\n if (key.length === 1) {\n this._query += key;\n this._filter();\n }\n break;\n }\n this.markDirty();\n }\n\n // ─── Rendering ───────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const maxVisible = this._options.maxVisible ?? 8;\n const placeholder = this._options.placeholder ?? 'Type to search...';\n\n // ── Row 0: query line ──────────────────────────\n const prefix = '> ';\n const queryDisplay = this._query.length > 0 ? this._query : placeholder;\n const queryDim = this._query.length === 0;\n const queryLine = truncate(prefix + queryDisplay, width);\n\n screen.writeString(x, y, queryLine, { ...attrs, dim: queryDim });\n\n // Fill rest of query row with spaces (clean background)\n const queryLineWidth = stringWidth(queryLine);\n for (let c = queryLineWidth; c < width; c++) {\n screen.setCell(x + c, y, { char: ' ', ...attrs });\n }\n\n // ── Rows 1..N: command list ────────────────────\n const listStartRow = 1;\n const listHeight = height - listStartRow;\n const visibleCount = Math.min(this._filtered.length, maxVisible, listHeight);\n\n for (let i = 0; i < visibleCount; i++) {\n const cmd = this._filtered[i];\n const isSelected = i === this._selectedIndex;\n const rowY = y + listStartRow + i;\n\n // Compose left part: prefix + label\n const rowPrefix = isSelected ? '▸ ' : ' ';\n const labelPart = rowPrefix + cmd.label;\n\n // Compose right part: description (dim, right-aligned)\n const desc = cmd.description ?? '';\n const descWidth = stringWidth(desc);\n\n // Available width for label (leave room for desc if it fits)\n const gap = 1; // minimum space between label and desc\n const labelMaxWidth = desc\n ? Math.max(0, width - descWidth - gap)\n : width;\n\n const labelTruncated = truncate(labelPart, labelMaxWidth);\n const labelWidth = stringWidth(labelTruncated);\n\n // Cell style for the row\n const cellStyle = {\n ...attrs,\n bold: isSelected,\n inverse: isSelected,\n };\n const dimStyle = {\n ...attrs,\n dim: true,\n inverse: isSelected,\n };\n\n // Write label\n screen.writeString(x, rowY, labelTruncated, cellStyle);\n\n // Fill gap between label and description\n if (desc) {\n const descX = x + width - descWidth;\n // Fill blank between label end and desc start\n for (let c = x + labelWidth; c < descX; c++) {\n screen.setCell(c, rowY, { char: ' ', ...cellStyle });\n }\n // Write description (right-aligned, dim)\n screen.writeString(descX, rowY, desc, dimStyle);\n } else {\n // Fill remainder of row for inverse highlight\n for (let c = x + labelWidth; c < x + width; c++) {\n screen.setCell(c, rowY, { char: ' ', ...cellStyle });\n }\n }\n }\n\n // Clear any rows below the visible commands (in case widget was larger)\n for (let i = visibleCount; i < listHeight; i++) {\n const rowY = y + listStartRow + i;\n for (let c = 0; c < width; c++) {\n screen.setCell(x + c, rowY, { char: ' ', ...attrs });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Button widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, type KeyEvent, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type ButtonVariant = 'default' | 'primary' | 'danger' | 'ghost';\n\nexport interface ButtonOptions {\n variant?: ButtonVariant;\n disabled?: boolean;\n onPress?: () => void;\n color?: Color;\n}\n\n/** Background colors for each variant */\nconst BG_COLORS: Record<ButtonVariant, Color> = {\n default: { type: 'named', name: 'brightBlack' },\n primary: { type: 'named', name: 'blue' },\n danger: { type: 'named', name: 'red' },\n ghost: { type: 'named', name: 'brightBlack' },\n};\n\n/** Foreground colors for each variant */\nconst FG_COLORS: Record<ButtonVariant, Color> = {\n default: { type: 'named', name: 'white' },\n primary: { type: 'named', name: 'white' },\n danger: { type: 'named', name: 'white' },\n ghost: { type: 'named', name: 'white' },\n};\n\n/**\n * Button — a pressable button with a label and visual variants.\n *\n * Renders a button with different visual styles based on variant.\n * Handles key events for activation when not disabled.\n */\nexport class Button extends Widget {\n private _label: string;\n private _variant: ButtonVariant;\n private _disabled: boolean;\n private _onPress?: () => void;\n private _color?: Color;\n\n constructor(label: string, style: Partial<Style> = {}, opts: ButtonOptions = {}) {\n super(style);\n this._label = label;\n this._variant = opts.variant ?? 'default';\n this._disabled = opts.disabled ?? false;\n this._onPress = opts.onPress;\n this._color = opts.color;\n this.focusable = true;\n }\n\n setLabel(label: string): void {\n if (this._label === label) return;\n\n this._label = label;\n this.markDirty();\n }\n\n setDisabled(disabled: boolean): void {\n if (this._disabled === disabled) return;\n \n this._disabled = disabled;\n this.markDirty();\n }\n\n handleKey(event: KeyEvent): void {\n if (this._disabled) return;\n\n if (event.key === 'enter' || event.key === 'space') {\n this._onPress?.();\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width <= 0 || height <= 0) return;\n\n const bg = this._color ?? BG_COLORS[this._variant];\n const fg = FG_COLORS[this._variant];\n // Focus indicator: use accent color when focused\n const borderFg = this.isFocused\n ? { type: 'named' as const, name: 'cyan' as const }\n : fg;\n\n // Choose border characters based on unicode support\n const tl = caps.unicode ? '┌' : '+';\n const tr = caps.unicode ? '┐' : '+';\n const bl = caps.unicode ? '└' : '+';\n const br = caps.unicode ? '┘' : '+';\n const hz = caps.unicode ? '─' : '-';\n const vt = caps.unicode ? '│' : '|';\n\n // Padded text: \" label \"\n const padded = ` ${this._label} `;\n const textWidth = stringWidth(padded);\n\n // Inner width is the area between left and right border\n const innerWidth = Math.min(textWidth, Math.max(0, width - 2));\n\n // ── Row 0: top border ──\n if (height >= 1) {\n screen.setCell(x, y, { char: tl, fg: borderFg, bg });\n for (let c = 1; c <= innerWidth; c++) {\n screen.setCell(x + c, y, { char: hz, fg: borderFg, bg });\n }\n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y, { char: tr, fg: borderFg, bg });\n }\n }\n\n // ── Row 1: content row ──\n if (height >= 2) {\n screen.setCell(x, y + 1, { char: vt, fg: borderFg, bg });\n \n // Center the text in the available width\n const startX = x + 1;\n const textStartX = startX + Math.floor((innerWidth - textWidth) / 2);\n \n // Write the centered label\n screen.writeString(textStartX, y + 1, padded, { fg: borderFg, bg });\n \n // Fill remaining space with background\n for (let c = textStartX + textWidth; c < startX + innerWidth; c++) {\n screen.setCell(c, y + 1, { char: ' ', fg: borderFg, bg });\n }\n \n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y + 1, { char: vt, fg: borderFg, bg });\n }\n }\n\n // ── Row 2: bottom border ──\n if (height >= 3) {\n screen.setCell(x, y + 2, { char: bl, fg: borderFg, bg });\n for (let c = 1; c <= innerWidth; c++) {\n screen.setCell(x + c, y + 2, { char: hz, fg: borderFg, bg });\n }\n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y + 2, { char: br, fg: borderFg, bg });\n }\n }\n }\n}","import {\n type Screen,\n type Style,\n type Color,\n type KeyEvent,\n styleToCellAttrs,\n stringWidth,\n caps,\n} from \"@termuijs/core\";\nimport { Widget } from \"../base/Widget.js\";\n\nexport interface SliderOptions {\n min?: number;\n max?: number;\n step?: number;\n color?: Color;\n showValue?: boolean;\n}\n\nexport class Slider extends Widget {\n private _label: string;\n private _value = 0;\n private _min: number;\n private _max: number;\n private _step: number;\n private _color: Color;\n private _showValue: boolean;\n\n constructor(\n label: string,\n style: Partial<Style> = {},\n opts: SliderOptions = {}\n ) {\n super(style);\n\n this._label = label;\n this._min = opts.min ?? 0;\n this._max = opts.max ?? 100;\n this._step = opts.step ?? 1;\n this._color = opts.color ?? { type: \"named\", name: \"cyan\" };\n this._showValue = opts.showValue ?? true;\n }\n\n getValue(): number {\n return this._value;\n }\n\n setValue(value: number): void {\n this._value = Math.max(this._min, Math.min(this._max, value));\n this.markDirty();\n }\n\n setLabel(label: string): void {\n this._label = label;\n this.markDirty();\n }\n\n handleKey(event: KeyEvent): void {\n switch (event.key) {\n case \"right\":\n this.setValue(this._value + this._step);\n break;\n case \"left\":\n this.setValue(this._value - this._step);\n break;\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n const leftArrow = caps.unicode ? \"◄\" : \"<\";\n const rightArrow = caps.unicode ? \"►\" : \">\";\n\n const valueStr = this._showValue ? ` ${this._value}%` : \"\";\n const prefix = `${this._label} ${leftArrow} `;\n const suffix = ` ${rightArrow}${valueStr}`;\n\n const prefixWidth = stringWidth(prefix);\n const suffixWidth = stringWidth(suffix);\n\n const trackWidth = Math.max(\n 0,\n width - prefixWidth - suffixWidth\n );\n\n const ratio =\n (this._value - this._min) /\n Math.max(1, this._max - this._min);\n\n const filled = Math.round(trackWidth * ratio);\n\n screen.writeString(x, y, prefix, {\n ...attrs,\n bold: true,\n });\n\n const trackX = x + prefixWidth;\n\n for (let i = 0; i < trackWidth; i++) {\n const filledChar = caps.unicode ? \"█\" : \"#\";\n const emptyChar = caps.unicode ? \"░\" : \"-\";\n\n screen.setCell(trackX + i, y, {\n char: i < filled ? filledChar : emptyChar,\n fg:\n i < filled\n ? this._color\n : { type: \"named\", name: \"brightBlack\" },\n });\n }\n\n screen.writeString(trackX + trackWidth, y, suffix, {\n ...attrs,\n bold: true,\n });\n }\n}","import { Widget } from '../base/Widget.js';\nimport {\n type Screen,\n type Style,\n type Color,\n type KeyEvent,\n styleToCellAttrs,\n caps,\n stringWidth,\n} from '@termuijs/core';\n\nexport interface RangeInputOptions {\n min?: number;\n max?: number;\n step?: number;\n color?: Color;\n showValue?: boolean;\n onChange?: (low: number, high: number) => void;\n}\n\nexport class RangeInput extends Widget {\n private _label: string;\n private _min: number;\n private _max: number;\n private _step: number;\n private _color: Color;\n private _showValue: boolean;\n private _activeHandle: 'low' | 'high';\n private _low: number;\n private _high: number;\n private _onChange?: (low: number, high: number) => void;\n\n constructor(\n label: string,\n style: Partial<Style> = {},\n opts: RangeInputOptions = {},\n ) {\n super(style);\n\n this._label = label;\n this._min = opts.min ?? 0;\n this._max = opts.max ?? 100;\n this._step = opts.step ?? 1;\n this._color = opts.color ?? { type: 'named', name: 'cyan' };\n this._showValue = opts.showValue ?? true;\n this._low = this._min;\n this._high = this._max;\n this._activeHandle = 'low';\n this._onChange = opts.onChange;\n\n this.focusable = true;\n }\n\n getLow(): number {\n return this._low;\n }\n\n getHigh(): number {\n return this._high;\n }\n\n setLow(value: number): void {\n const clamped = Math.max(this._min, Math.min(value, this._high));\n if (clamped === this._low) return;\n this._low = clamped;\n this.markDirty();\n this._onChange?.(this._low, this._high);\n }\n\n setHigh(value: number): void {\n const clamped = Math.min(this._max, Math.max(value, this._low));\n if (clamped === this._high) return;\n this._high = clamped;\n this.markDirty();\n this._onChange?.(this._low, this._high);\n }\n\n setRange(low: number, high: number): void {\n const newLow = Math.max(this._min, Math.min(low, high));\n const newHigh = Math.min(this._max, Math.max(low, high));\n if (newLow === this._low && newHigh === this._high) return;\n this._low = newLow;\n this._high = newHigh;\n this.markDirty();\n this._onChange?.(this._low, this._high);\n }\n\n handleKey(event: KeyEvent): void {\n if (event.key === 'tab') {\n this._activeHandle =\n this._activeHandle === 'low' ? 'high' : 'low';\n this.markDirty();\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (this._activeHandle === 'low') {\n if (event.key === 'right') this.setLow(this._low + this._step);\n if (event.key === 'left') this.setLow(this._low - this._step);\n } else {\n if (event.key === 'right') this.setHigh(this._high + this._step);\n if (event.key === 'left') this.setHigh(this._high - this._step);\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Layout: \"Label ◄ [track] ► low – high\"\n const labelStr = this._label + ' ';\n const leftCap = caps.unicode ? '◄ ' : '< ';\n const rightCap = caps.unicode ? ' ►' : ' >';\n const valueStr = this._showValue\n ? ` ${this._low} – ${this._high}`\n : '';\n\n const labelWidth = stringWidth(labelStr);\n const leftCapWidth = stringWidth(leftCap);\n const rightCapWidth = stringWidth(rightCap);\n const valueWidth = stringWidth(valueStr);\n\n const trackWidth = Math.max(\n 0,\n width - labelWidth - leftCapWidth - rightCapWidth - valueWidth,\n );\n\n // Render label\n screen.writeString(x, y, labelStr, { ...attrs, bold: true });\n\n // Render left cap\n screen.writeString(x + labelWidth, y, leftCap, attrs);\n\n // Render track (3 zones: before low, between low–high, after high)\n const range = this._max - this._min || 1;\n const lowCell = Math.round(trackWidth * (this._low - this._min) / range);\n const highCell = Math.round(trackWidth * (this._high - this._min) / range);\n const trackX = x + labelWidth + leftCapWidth;\n\n for (let i = 0; i < trackWidth; i++) {\n const inRange = i >= lowCell && i < highCell;\n const isActiveLow = i === lowCell && this._activeHandle === 'low';\n const isActiveHigh = i === highCell - 1 && this._activeHandle === 'high';\n\n const char = inRange\n ? (caps.unicode ? '█' : '#')\n : (caps.unicode ? '░' : '-');\n\n screen.setCell(trackX + i, y, {\n char,\n fg: (isActiveLow || isActiveHigh)\n ? { type: 'named', name: 'yellow' }\n : inRange\n ? this._color\n : { type: 'named', name: 'brightBlack' },\n });\n }\n\n // Render right cap\n screen.writeString(trackX + trackWidth, y, rightCap, attrs);\n\n // Render value\n if (this._showValue) {\n screen.writeString(trackX + trackWidth + rightCapWidth, y, valueStr, {\n ...attrs,\n bold: true,\n });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — TextInput widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate, type KeyEvent } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * TextInput — a single-line text input field.\n *\n * Supports:\n * - Cursor movement (left/right/Home/End)\n * - Character insertion and deletion\n * - Placeholder text\n * - Password masking\n * - Max length constraint\n */\nexport class TextInput extends Widget {\n private _value = '';\n private _cursorPos = 0;\n private _placeholder: string;\n private _mask: string | null;\n private _maxLength: number;\n private _onChange?: (value: string) => void;\n private _onSubmit?: (value: string) => void;\n\n constructor(\n style: Partial<Style> = {},\n options: {\n placeholder?: string;\n mask?: string;\n maxLength?: number;\n onChange?: (value: string) => void;\n onSubmit?: (value: string) => void;\n } = {},\n ) {\n super({ border: 'single', height: 3, ...style });\n this._placeholder = options.placeholder ?? '';\n this._mask = options.mask ?? null;\n this._maxLength = options.maxLength ?? Infinity;\n this._onChange = options.onChange;\n this._onSubmit = options.onSubmit;\n this.focusable = true;\n }\n\n get value(): string { return this._value; }\n set value(v: string) {\n this._value = v.slice(0, this._maxLength);\n this._cursorPos = Math.min(this._cursorPos, this._value.length);\n this.markDirty();\n }\n\n /**\n * Handle keyboard events when the widget is focused.\n */\n handleKey(event: KeyEvent): void {\n switch (event.key) {\n case 'left':\n this.moveCursorLeft();\n break;\n case 'right':\n this.moveCursorRight();\n break;\n case 'home':\n this.moveCursorHome();\n break;\n case 'end':\n this.moveCursorEnd();\n break;\n case 'backspace':\n this.deleteBack();\n break;\n case 'delete':\n this.deleteForward();\n break;\n case 'enter':\n this.submit();\n break;\n default:\n // Insert printable characters (length 1 means it's a typing char, not a special key)\n if (event.key.length === 1 && !event.ctrl && !event.alt) {\n this.insertChar(event.key);\n }\n break;\n }\n }\n\n /**\n * Handle a typed character.\n */\n insertChar(char: string): void {\n if (this._value.length >= this._maxLength) return;\n this._value =\n this._value.slice(0, this._cursorPos) +\n char +\n this._value.slice(this._cursorPos);\n this._cursorPos++;\n this._onChange?.(this._value);\n this.markDirty();\n }\n\n /**\n * Delete the character before the cursor.\n */\n deleteBack(): void {\n if (this._cursorPos > 0) {\n this._value =\n this._value.slice(0, this._cursorPos - 1) +\n this._value.slice(this._cursorPos);\n this._cursorPos--;\n this._onChange?.(this._value);\n this.markDirty();\n }\n }\n\n /**\n * Delete the character after the cursor.\n */\n deleteForward(): void {\n if (this._cursorPos < this._value.length) {\n this._value =\n this._value.slice(0, this._cursorPos) +\n this._value.slice(this._cursorPos + 1);\n this._onChange?.(this._value);\n this.markDirty();\n }\n }\n\n moveCursorLeft(): void {\n const next = Math.max(0, this._cursorPos - 1);\n \n if (next === this._cursorPos) {\n return;\n }\n \n this._cursorPos = next;\n this.markDirty();\n }\n moveCursorRight(): void {\n const next = Math.min(this._value.length, this._cursorPos + 1);\n \n if (next === this._cursorPos) {\n return;\n }\n \n this._cursorPos = next;\n this.markDirty();\n }\n moveCursorHome(): void {\n if (this._cursorPos === 0) {\n return;\n }\n \n this._cursorPos = 0;\n this.markDirty();\n }\n moveCursorEnd(): void {\n if (this._cursorPos === this._value.length) {\n return;\n }\n \n this._cursorPos = this._value.length;\n this.markDirty();\n }\n\n submit(): void { this._onSubmit?.(this._value); }\n clear(): void { this._value = ''; this._cursorPos = 0; this._onChange?.(''); \n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n if (this._value.length === 0 && !this.isFocused) {\n // Show placeholder\n screen.writeString(x, y, truncate(this._placeholder, width), { ...attrs, dim: true });\n return;\n }\n\n // Display value (optionally masked)\n const displayValue = this._mask\n ? this._mask.repeat(this._value.length)\n : this._value;\n\n // Scroll the view if cursor is beyond visible area\n const visibleWidth = width - 1; // Leave room for cursor\n let scrollX = 0;\n if (this._cursorPos > visibleWidth) {\n scrollX = this._cursorPos - visibleWidth;\n }\n\n const visibleText = displayValue.slice(scrollX, scrollX + visibleWidth);\n screen.writeString(x, y, visibleText, attrs);\n\n // Draw cursor when focused\n if (this.isFocused) {\n const cursorScreenPos = x + this._cursorPos - scrollX;\n if (cursorScreenPos >= x && cursorScreenPos < x + width) {\n const cursorChar = this._cursorPos < displayValue.length\n ? displayValue[this._cursorPos]\n : ' ';\n screen.setCell(cursorScreenPos, y, {\n char: cursorChar,\n ...attrs,\n inverse: true,\n });\n }\n }\n }\n}\n","import {\n type Screen,\n type Style,\n type Color,\n type KeyEvent,\n styleToCellAttrs,\n caps,\n stringWidth,\n} from \"@termuijs/core\";\nimport { Widget } from \"../base/Widget.js\";\n\nexport interface KnobOptions {\n min?: number;\n max?: number;\n step?: number;\n color?: Color;\n showValue?: boolean;\n onChange?: (value: number) => void;\n}\n\nexport class Knob extends Widget {\n private _label: string;\n private _value: number;\n private _min: number;\n private _max: number;\n private _step: number;\n private _color: Color;\n private _showValue: boolean;\n private _onChange?: (value: number) => void;\n\n constructor(\n label?: string,\n style: Partial<Style> = {},\n opts: KnobOptions = {}\n ) {\n super(style);\n\n this.focusable = true;\n this._label = label ?? \"\";\n this._min = opts.min ?? 0;\n \n // Validate max to ensure min <= max\n const maxVal = opts.max ?? 100;\n this._max = maxVal >= this._min ? maxVal : this._min;\n \n this._value = this._min;\n \n // Validate step to ensure it is positive\n const stepVal = opts.step ?? 1;\n this._step = stepVal > 0 ? stepVal : 1;\n \n this._color = opts.color ?? { type: \"named\", name: \"cyan\" };\n this._showValue = opts.showValue ?? true;\n this._onChange = opts.onChange;\n }\n\n get value(): number {\n return this._value;\n }\n\n setValue(value: number): void {\n const clamped = Math.max(this._min, Math.min(this._max, value));\n if (this._value === clamped) return;\n\n this._value = clamped;\n this.markDirty();\n this._onChange?.(this._value);\n }\n\n handleKey(event: KeyEvent): void {\n switch (event.key) {\n case \"up\":\n case \"right\":\n this.setValue(this._value + this._step);\n break;\n case \"down\":\n case \"left\":\n this.setValue(this._value - this._step);\n break;\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n const cx = (width - 1) / 2;\n const cy = (height - 1) / 2;\n // Account for character aspect ratio (roughly 1:2)\n const radiusX = Math.max(1, (width - 1) / 2);\n const radiusY = Math.max(1, (height - 1) / 2);\n \n // We want the arc to sweep from bottom-left (-135 deg or ~235 deg) \n // to bottom-right (135 deg or ~305 deg). \n // In polar coordinates with Y pointing down (terminal grids):\n // 0 rad is pointing right (3 o'clock).\n // Math.PI/2 is pointing down (6 o'clock).\n // We'll define startAngle = 135 deg (3/4 PI)\n // and endAngle = 45 deg (1/4 PI) BUT looping clockwise.\n // Meaning it spans from 135 deg -> 180 -> 270(up) -> 0 -> 45 deg.\n // Total sweep is 270 degrees.\n const sweepRange = 270;\n \n const rangeSize = Math.max(1, this._max - this._min);\n const ratio = (this._value - this._min) / rangeSize;\n const filledSweepDegrees = ratio * sweepRange;\n\n for (let row = 0; row < height; row++) {\n for (let col = 0; col < width; col++) {\n // Normalize dx, dy to a pure circle\n const dx = (col - cx) / radiusX;\n const dy = (row - cy) / radiusY;\n \n // Distance from center in normalized space\n const r = Math.sqrt(dx * dx + dy * dy);\n \n // We only draw if it's on the edge of the circle (thickness ~0.2)\n if (r < 0.8 || r > 1.2) {\n continue;\n }\n\n // Calculate angle. atan2(dy, dx) returns angle from -PI to PI.\n // Convert to degrees 0-360 starting from 3 o'clock clockwise.\n let angleDeg = Math.atan2(dy, dx) * (180 / Math.PI);\n if (angleDeg < 0) {\n angleDeg += 360;\n }\n\n // We shift the angle so 0 starts at bottom-left (135 deg original)\n // 135 becomes 0.\n // 270(up) becomes 135.\n // 0(right) becomes 225.\n // 45(bottom-right) becomes 270.\n let shiftedAngle = angleDeg - 135;\n if (shiftedAngle < 0) {\n shiftedAngle += 360;\n }\n\n // If it falls in the \"gap\" at the bottom (between 270 and 360 in shifted coordinates)\n if (shiftedAngle > sweepRange) {\n continue;\n }\n\n const isFilled = shiftedAngle <= filledSweepDegrees;\n const charToRender = caps.unicode ? \"█\" : \"#\";\n\n screen.setCell(x + col, y + row, {\n ...attrs,\n char: charToRender,\n fg: isFilled \n ? (this.isFocused ? { type: \"named\", name: \"white\" } : this._color)\n : { type: \"named\", name: \"brightBlack\" },\n });\n }\n }\n\n if (this._showValue) {\n const valStr = String(this._value);\n const valWidth = stringWidth(valStr);\n const valX = x + Math.floor((width - valWidth) / 2);\n const valY = y + Math.floor(height / 2);\n\n // Print in center, but only if it fits inside the circle\n // We assume it fits if the width/height are reasonable (>4)\n if (width >= 4 && height >= 3) {\n screen.writeString(valX, valY, valStr, {\n ...attrs,\n bold: true,\n fg: this.isFocused ? { type: \"named\", name: \"white\" } : this._color\n });\n }\n }\n }\n}\n","import {\n type Screen,\n type Style,\n type KeyEvent,\n styleToCellAttrs,\n caps,\n} from \"@termuijs/core\";\nimport { Widget } from \"../base/Widget.js\";\n\nexport interface PinInputOptions {\n length?: number;\n masked?: boolean;\n onChange?: (value: string) => void;\n onComplete?: (value: string) => void;\n}\n\nexport class PinInput extends Widget {\n private _length: number;\n private _masked: boolean;\n private _value: string[];\n private _cursorPos: number = 0;\n private _onChange?: (value: string) => void;\n private _onComplete?: (value: string) => void;\n\n /**\n * Creates a new PinInput widget.\n *\n * @param style Partial style properties for the widget.\n * @param opts Configuration options for the PinInput.\n */\n constructor(\n style: Partial<Style> = {},\n opts: PinInputOptions = {}\n ) {\n super(style);\n this.focusable = true;\n\n this._length = Math.max(1, Math.floor(opts.length ?? 4));\n this._masked = opts.masked ?? false;\n this._onChange = opts.onChange;\n this._onComplete = opts.onComplete;\n \n // Initialize empty array of correct length\n this._value = Array(this._length).fill(\"\");\n }\n\n get value(): string {\n return this._value.join(\"\");\n }\n\n private get _isFull(): boolean {\n return this._value.every((v) => v !== \"\");\n }\n\n handleKey(event: KeyEvent): void {\n const key = event.key;\n\n if (key === \"left\") {\n this._cursorPos = Math.max(0, this._cursorPos - 1);\n this.markDirty();\n return;\n }\n\n if (key === \"right\") {\n this._cursorPos = Math.min(this._length - 1, this._cursorPos + 1);\n this.markDirty();\n return;\n }\n\n if (key === \"backspace\" || key === \"delete\") {\n if (this._value[this._cursorPos] !== \"\") {\n // Clear current block\n this._value[this._cursorPos] = \"\";\n } else if (this._cursorPos > 0) {\n // Move back and clear\n this._cursorPos--;\n this._value[this._cursorPos] = \"\";\n }\n \n this.markDirty();\n this._onChange?.(this.value);\n return;\n }\n\n // Handle character input\n if (key.length === 1) {\n // Set value at current position\n this._value[this._cursorPos] = key;\n this.markDirty();\n \n const currentVal = this.value;\n this._onChange?.(currentVal);\n\n // Advance cursor or trigger complete\n this._cursorPos = Math.min(this._length - 1, this._cursorPos + 1);\n \n if (this._isFull) {\n this._onComplete?.(this.value);\n }\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n let currentX = x;\n\n for (let i = 0; i < this._length; i++) {\n // Check if this block would render out of bounds\n if (currentX + 5 > x + width) {\n break; // Stop rendering if it exceeds width\n }\n\n const isFocusedBlock = this.isFocused && this._cursorPos === i;\n const charVal = this._value[i];\n let displayChar = \" \";\n\n if (charVal !== \"\") {\n displayChar = this._masked ? (caps.unicode ? \"•\" : \"*\") : charVal;\n }\n\n const blockStr = `[ ${displayChar} ]`;\n\n // Apply inverse colors for the focused block\n const blockAttrs = {\n ...attrs,\n inverse: isFocusedBlock ? !attrs.inverse : attrs.inverse,\n };\n\n screen.writeString(currentX, y, blockStr, blockAttrs);\n currentX += 5; // [ + space + char + space + ] -> 5 columns. We space them out.\n \n // Add gap between blocks\n currentX += 1;\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ContextMenu widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface ContextMenuItem {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\n/**\n * ContextMenu — a floating menu widget positioned at absolute coordinates.\n *\n * Supports:\n * - Keyboard navigation (up/down arrows)\n * - Selection confirmation (Enter)\n * - Menu dismissal (Escape)\n * - Callback on item selection\n * - Disabled items\n * - Safe ASCII fallback for unicode icons\n */\nexport class ContextMenu extends Widget {\n private _items: ContextMenuItem[];\n private _selectedIndex = 0;\n private _x: number;\n private _y: number;\n private _onItemSelect?: (item: ContextMenuItem, index: number) => void;\n private _onClose?: () => void;\n\n constructor(\n items: ContextMenuItem[],\n x: number,\n y: number,\n style: Partial<Style> = {},\n callbacks?: {\n onItemSelect?: (item: ContextMenuItem, index: number) => void;\n onClose?: () => void;\n },\n ) {\n super(style);\n this._items = items;\n this._x = x;\n this._y = y;\n this._onItemSelect = callbacks?.onItemSelect;\n this._onClose = callbacks?.onClose;\n this.focusable = true;\n\n // Set position-based rect for context menu\n this._updateRect();\n }\n\n /**\n * Update the internal rect based on position and items count.\n * ContextMenu is typically 1-2 characters wider than the longest item label,\n * and height matches the number of items.\n */\n private _updateRect(): void {\n let maxWidth = 10; // Minimum width\n for (const item of this._items) {\n const w = stringWidth(item.label) + 2; // +2 for prefix (e.g., '> ')\n maxWidth = Math.max(maxWidth, w);\n }\n\n this._rect = {\n x: this._x,\n y: this._y,\n width: maxWidth,\n height: Math.max(1, this._items.length),\n };\n }\n\n get selectedIndex(): number { return this._selectedIndex; }\n get selectedItem(): ContextMenuItem | undefined { return this._items[this._selectedIndex]; }\n\n /**\n * Move selection up\n */\n selectPrev(): void {\n let next = this._selectedIndex - 1;\n while (next >= 0 && this._items[next].disabled) next--;\n if (next >= 0) {\n this._selectedIndex = next;\n this.markDirty();\n }\n }\n\n /**\n * Move selection down\n */\n selectNext(): void {\n let next = this._selectedIndex + 1;\n while (next < this._items.length && this._items[next].disabled) next++;\n if (next < this._items.length) {\n this._selectedIndex = next;\n this.markDirty();\n }\n }\n\n /**\n * Confirm the current selection\n */\n confirm(): void {\n const item = this._items[this._selectedIndex];\n if (item && !item.disabled) {\n this._onItemSelect?.(item, this._selectedIndex);\n }\n }\n\n /**\n * Close the context menu\n */\n close(): void {\n this._onClose?.();\n }\n\n /**\n * Move the context menu to a new position\n */\n moveTo(x: number, y: number): void {\n if (this._x === x && this._y === y) {\n return;\n }\n this._x = x;\n this._y = y;\n this._updateRect();\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n for (let i = 0; i < this._items.length && i < height; i++) {\n const item = this._items[i];\n const isSelected = i === this._selectedIndex;\n\n // Compose the line with a prefix indicator\n const prefix = isSelected ? (caps.unicode ? '▸ ' : '> ') : ' ';\n let line = prefix + item.label;\n line = truncate(line, width);\n\n // Cell style: bold if selected, dim if disabled\n const cellStyle = {\n ...attrs,\n bold: isSelected,\n dim: item.disabled ?? false,\n inverse: isSelected && this.isFocused,\n };\n\n screen.writeString(x, y + i, line, cellStyle);\n\n // Fill rest of line for inverse highlight\n if (isSelected && this.isFocused) {\n const remaining = width - stringWidth(line);\n for (let c = 0; c < remaining; c++) {\n screen.setCell(x + stringWidth(line) + c, y + i, { char: ' ', ...cellStyle });\n }\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Table widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, type KeyEvent, styleToCellAttrs, stringWidth, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { type TableState } from './TableState.js';\n\nexport interface TableColumn {\n /** Column header label */\n header: string;\n /** Key to pull data from row objects */\n key: string;\n /** Fixed width (chars). If omitted, auto-distributes. */\n width?: number;\n /** Text alignment within the column */\n align?: 'left' | 'center' | 'right';\n}\n\nexport type TableRow = Record<string, string | number>;\n\nexport interface TableOptions {\n /** Whether to show the header row */\n showHeader?: boolean;\n /** Color for the header row */\n headerColor?: Color;\n /** Whether rows are zebra-striped */\n stripe?: boolean;\n /** Stripe color */\n stripeColor?: Color;\n /** Column separator character */\n separator?: string;\n}\n\nexport interface TableProps {\n columns: TableColumn[];\n rows?: TableRow[];\n style?: Partial<Style>;\n options?: TableOptions;\n /** External state object – if provided, Table syncs rows through it */\n state?: TableState;\n /** Called whenever rows change via setRows */\n onStateChange?: (state: TableState) => void;\n}\n\n/**\n * Table — renders tabular data with columns, headers, and optional zebra-striping.\n *\n * Supports:\n * - Auto-width column distribution\n * - Fixed and percentage widths\n * - Header styling\n * - Zebra striping\n * - Text alignment per column\n * - Truncation for overflow\n * - External state via `state` prop and `useTableState` hook\n */\nexport class Table extends Widget {\n protected _columns: TableColumn[];\n protected _rows: TableRow[];\n protected _showHeader: boolean;\n protected _headerColor: Color;\n protected _stripe: boolean;\n protected _stripeColor: Color;\n protected _separator: string;\n private _state?: TableState;\n private _onStateChange?: (state: TableState) => void;\n private _selectedRow = 0;\n private _sortColumn = '';\n\n constructor(\n columnsOrProps: TableColumn[] | TableProps,\n rows: TableRow[] = [],\n style: Partial<Style> = {},\n options: TableOptions = {},\n ) {\n let columns: TableColumn[];\n let state: TableState | undefined;\n let onStateChange: ((s: TableState) => void) | undefined;\n\n if (Array.isArray(columnsOrProps)) {\n columns = columnsOrProps;\n } else {\n const props = columnsOrProps as TableProps;\n columns = props.columns;\n rows = props.rows ?? [];\n style = props.style ?? style;\n options = props.options ?? options;\n state = props.state;\n onStateChange = props.onStateChange;\n }\n\n super(style);\n this._columns = columns;\n this._rows = rows;\n this._showHeader = options.showHeader ?? true;\n this._headerColor = options.headerColor ?? { type: 'named', name: 'cyan' };\n this._stripe = options.stripe ?? true;\n this._stripeColor = options.stripeColor ?? { type: 'named', name: 'brightBlack' };\n this._separator = options.separator ?? ' │ ';\n this._state = state;\n this._onStateChange = onStateChange;\n }\n\n // ── Mutations ─────────────────────────────────────\n\n setRows(rows: TableRow[]): void {\n this._rows = rows;\n this.markDirty();\n this._pushState();\n }\n\n sortByColumn(columnKey: string): void {\n this._sortColumn = columnKey;\n\n this._rows.sort((a, b) =>\n String(a[columnKey] ?? '').localeCompare(\n String(b[columnKey] ?? '')\n )\n );\n\n this.markDirty();\n}\n\n // ── External state sync ───────────────────────────\n\n private _pushState(): void {\n if (this._state) {\n this._state.rows = this._rows;\n this._onStateChange?.(this._state);\n }\n }\n\n handleKey(event: KeyEvent): void {\n if (event.key === 'up') {\n this._selectedRow = Math.max(0, this._selectedRow - 1);\n }\n\n if (event.key === 'down') {\n this._selectedRow = Math.min(\n this._rows.length - 1,\n this._selectedRow + 1\n );\n }\n\n this.markDirty();\n }\n\n // ── Rendering ─────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const sepWidth = stringWidth(this._separator);\n\n // Calculate column widths\n const colWidths = this._computeColumnWidths(\n width - (this._columns.length - 1) * sepWidth,\n );\n\n let row = 0;\n\n // Render header\n if (this._showHeader && row < height) {\n let cx = x;\n for (let c = 0; c < this._columns.length; c++) {\n const col = this._columns[c];\n const cellText = this._alignText(col.header, colWidths[c], col.align ?? 'left');\n screen.writeString(cx, y + row, cellText, {\n ...attrs,\n fg: this._headerColor,\n bold: true,\n });\n cx += colWidths[c];\n if (c < this._columns.length - 1) {\n screen.writeString(cx, y + row, this._separator, { ...attrs, dim: true });\n cx += sepWidth;\n }\n }\n row++;\n\n // Header separator line\n if (row < height) {\n const sepLine = '─'.repeat(width);\n screen.writeString(x, y + row, sepLine, { ...attrs, dim: true });\n row++;\n }\n }\n\n // Render data rows\n for (let r = 0; r < this._rows.length && row < height; r++) {\n const dataRow = this._rows[r];\n const isStripe = this._stripe && r % 2 === 1;\n const isSelected = r === this._selectedRow;\n let cx = x;\n\n for (let c = 0; c < this._columns.length; c++) {\n const col = this._columns[c];\n const rawValue = String(dataRow[col.key] ?? '');\n const cellText = this._alignText(rawValue, colWidths[c], col.align ?? 'left');\n\n screen.writeString(cx, y + row, cellText, {\n ...attrs,\n bg: isSelected\n ? { type: 'named', name: 'blue' }\n : isStripe\n ? this._stripeColor\n : attrs.bg,\n});\n cx += colWidths[c];\n if (c < this._columns.length - 1) {\n screen.writeString(cx, y + row, this._separator, {\n ...attrs,\n dim: true,\n bg: isStripe ? this._stripeColor : attrs.bg,\n });\n cx += sepWidth;\n }\n }\n\n // Fill remaining width for stripe\n if (isStripe) {\n for (let fx = cx; fx < x + width; fx++) {\n screen.setCell(fx, y + row, { char: ' ', bg: this._stripeColor });\n }\n }\n\n row++;\n }\n }\n\n protected _computeColumnWidths(totalWidth: number): number[] {\n const fixedCols = this._columns.filter(c => c.width !== undefined);\n const flexCols = this._columns.filter(c => c.width === undefined);\n\n const usedWidth = fixedCols.reduce((sum, c) => sum + (c.width ?? 0), 0);\n const remainingWidth = Math.max(0, totalWidth - usedWidth);\n const flexWidth = flexCols.length > 0 ? Math.floor(remainingWidth / flexCols.length) : 0;\n\n return this._columns.map(c => c.width ?? flexWidth);\n }\n\n protected _alignText(text: string, width: number, align: 'left' | 'center' | 'right'): string {\n const truncated = truncate(text, width);\n const textWidth = stringWidth(truncated);\n const pad = Math.max(0, width - textWidth);\n\n switch (align) {\n case 'right':\n return ' '.repeat(pad) + truncated;\n case 'center': {\n const left = Math.floor(pad / 2);\n const right = pad - left;\n return ' '.repeat(left) + truncated + ' '.repeat(right);\n }\n case 'left':\n default:\n return truncated + ' '.repeat(pad);\n }\n }\n}\n","// packages/widgets/src/data/TableState.ts\nimport { TableRow } from './Table.js';\n\n/** External state object for Table widget. */\nexport interface TableState {\n /** Rows displayed by the table */\n rows: TableRow[];\n /** Scroll offset (first visible row index) */\n scrollOffset: number;\n /** Update rows */\n setRows(rows: TableRow[]): void;\n /** Scroll up */\n scrollPrev(): void;\n /** Scroll down */\n scrollNext(): void;\n}\n\n/** Hook that creates a fresh TableState. */\nexport function useTableState(initial: { rows: TableRow[] }): TableState {\n const state: TableState = {\n rows: initial.rows,\n scrollOffset: 0,\n setRows(rows: TableRow[]) {\n state.rows = rows;\n if (state.scrollOffset >= rows.length) {\n state.scrollOffset = Math.max(0, rows.length - 1);\n }\n },\n scrollPrev() {\n if (state.scrollOffset > 0) {\n state.scrollOffset--;\n }\n },\n scrollNext() {\n state.scrollOffset++;\n },\n };\n return state;\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — TreeTable widget\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type Color,\n type KeyEvent,\n styleToCellAttrs,\n stringWidth,\n truncate,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface TreeTableColumn {\n /** Column header label */\n header: string;\n /** Key to pull data from row objects */\n key: string;\n /** Fixed width (chars). If omitted, auto-distributes. */\n width?: number;\n /** Text alignment within the column */\n align?: 'left' | 'center' | 'right';\n}\n\nexport interface TreeTableRow {\n children?: TreeTableRow[];\n expanded?: boolean;\n [key: string]: unknown;\n}\n\nexport interface TreeTableOptions {\n /** Whether to show the header row */\n showHeader?: boolean;\n /** Color for the header row */\n headerColor?: Color;\n /** Whether rows are zebra-striped */\n stripe?: boolean;\n /** Stripe color */\n stripeColor?: Color;\n /** Column separator character */\n separator?: string;\n /** Indentation per depth (default 2) */\n indent?: number;\n /** Callback when a row is selected */\n onSelect?: (row: TreeTableRow) => void;\n}\n\ninterface VisibleEntry {\n row: TreeTableRow;\n depth: number;\n}\n\n/**\n * TreeTable — combines Tree expand/collapse with Table columns.\n *\n * Supports:\n * - Nested rows with column alignment\n * - Expand/collapse with arrows or Enter\n * - Keyboard navigation\n * - Unicode and ASCII symbols\n * - Zebra striping\n * - Header styling\n */\nexport class TreeTable extends Widget {\n private _columns: TreeTableColumn[];\n private _rows: TreeTableRow[];\n private _showHeader: boolean;\n private _headerColor: Color;\n private _stripe: boolean;\n private _stripeColor: Color;\n private _separator: string;\n private _indent: number;\n private _onSelect?: (row: TreeTableRow) => void;\n protected _selectedIndex = 0;\n protected _scrollOffset = 0;\n protected _visibleRows: VisibleEntry[] = [];\n\n constructor(\n columns: TreeTableColumn[],\n rows: TreeTableRow[],\n style: Partial<Style> = {},\n options: TreeTableOptions = {},\n ) {\n super(style);\n this._columns = columns;\n this._rows = rows;\n this._showHeader = options.showHeader ?? true;\n this._headerColor = options.headerColor ?? { type: 'named', name: 'cyan' };\n this._stripe = options.stripe ?? true;\n this._stripeColor = options.stripeColor ?? { type: 'named', name: 'brightBlack' };\n this._separator = options.separator ?? ' │ ';\n this._indent = options.indent ?? 2;\n this._onSelect = options.onSelect;\n this.focusable = true;\n this._buildVisibleRows();\n }\n\n // ── Public API ─────────────────────────────────────\n\n get selectedIndex(): number { return this._selectedIndex; }\n\n get selectedRow(): TreeTableRow | undefined {\n return this._visibleRows[this._selectedIndex]?.row;\n }\n\n setRows(rows: TreeTableRow[]): void {\n this._rows = rows;\n this._selectedIndex = 0;\n this._scrollOffset = 0;\n this._buildVisibleRows();\n this.markDirty();\n }\n\n /** Move cursor up one visible row */\n movePrev(): void {\n if (this._selectedIndex > 0) {\n this._selectedIndex--;\n this._clampScroll();\n this.markDirty();\n this._onSelect?.(this._visibleRows[this._selectedIndex].row);\n }\n }\n\n /** Move cursor down one visible row */\n moveNext(): void {\n if (this._selectedIndex < this._visibleRows.length - 1) {\n this._selectedIndex++;\n this._clampScroll();\n this.markDirty();\n this._onSelect?.(this._visibleRows[this._selectedIndex].row);\n }\n }\n\n /** Go to first visible row */\n moveFirst(): void {\n this._selectedIndex = 0;\n this._clampScroll();\n this.markDirty();\n this._onSelect?.(this._visibleRows[this._selectedIndex].row);\n }\n\n /** Go to last visible row */\n moveLast(): void {\n if (this._visibleRows.length > 0) {\n this._selectedIndex = this._visibleRows.length - 1;\n this._clampScroll();\n this.markDirty();\n this._onSelect?.(this._visibleRows[this._selectedIndex].row);\n }\n }\n\n /** Expand the selected row (if it has children and is collapsed) */\n expand(): void {\n const entry = this._visibleRows[this._selectedIndex];\n if (!entry) return;\n const row = entry.row;\n if (_isParent(row) && !row.expanded) {\n row.expanded = true;\n this._buildVisibleRows();\n this.markDirty();\n }\n }\n\n /** Collapse the selected row, or move to parent if already collapsed/leaf */\n collapse(): void {\n const entry = this._visibleRows[this._selectedIndex];\n if (!entry) return;\n const row = entry.row;\n\n if (_isParent(row) && row.expanded) {\n row.expanded = false;\n this._buildVisibleRows();\n this._clampScroll();\n this.markDirty();\n }\n }\n\n /** Toggle expand/collapse */\n toggle(): void {\n const entry = this._visibleRows[this._selectedIndex];\n if (!entry) return;\n const row = entry.row;\n\n if (_isParent(row)) {\n row.expanded = !row.expanded;\n this._buildVisibleRows();\n this._clampScroll();\n this.markDirty();\n } else {\n this._onSelect?.(row);\n }\n }\n\n /**\n * Handle a key event. Call this from your app's key-routing logic\n * when this widget is focused.\n */\n handleKey(event: KeyEvent): void {\n switch (event.key) {\n case 'up':\n case 'k':\n this.movePrev();\n break;\n case 'down':\n case 'j':\n this.moveNext();\n break;\n case 'enter':\n case 'space':\n this.toggle();\n break;\n case 'left':\n case 'h':\n this.collapse();\n break;\n case 'right':\n case 'l':\n this.expand();\n break;\n case 'home':\n this.moveFirst();\n break;\n case 'end':\n this.moveLast();\n break;\n }\n }\n\n // ── Rendering ──────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const sepWidth = stringWidth(this._separator);\n const useUnicode = caps.unicode;\n\n const collapsedChevron = useUnicode ? '▶ ' : '> ';\n const expandedChevron = useUnicode ? '▼ ' : 'v ';\n const leafPrefix = useUnicode ? '• ' : '* ';\n\n // Calculate column widths\n const colWidths = this._computeColumnWidths(\n width - (this._columns.length - 1) * sepWidth,\n );\n\n let row = 0;\n\n // Render header\n if (this._showHeader && row < height) {\n let cx = x;\n for (let c = 0; c < this._columns.length; c++) {\n const col = this._columns[c];\n const cellText = this._alignText(col.header, colWidths[c], col.align ?? 'left');\n screen.writeString(cx, y + row, cellText, {\n ...attrs,\n fg: this._headerColor,\n bold: true,\n });\n cx += colWidths[c];\n if (c < this._columns.length - 1) {\n screen.writeString(cx, y + row, this._separator, { ...attrs, dim: true });\n cx += sepWidth;\n }\n }\n row++;\n\n // Header separator line\n if (row < height) {\n const sepLine = '─'.repeat(width);\n screen.writeString(x, y + row, sepLine, { ...attrs, dim: true });\n row++;\n }\n }\n\n // Render visible data rows\n const visibleCount = Math.min(this._visibleRows.length - this._scrollOffset, height - row);\n for (let i = 0; i < visibleCount; i++) {\n const entryIdx = this._scrollOffset + i;\n const entry = this._visibleRows[entryIdx];\n const { row: dataRow, depth } = entry;\n const isSelected = entryIdx === this._selectedIndex && this.isFocused;\n const isStripe = this._stripe && i % 2 === 1;\n\n const indentStr = ' '.repeat(this._indent * depth);\n let prefix: string;\n if (_isParent(dataRow)) {\n prefix = dataRow.expanded ? expandedChevron : collapsedChevron;\n } else {\n prefix = leafPrefix;\n }\n const fullPrefix = indentStr + prefix;\n\n let cx = x;\n for (let c = 0; c < this._columns.length; c++) {\n const col = this._columns[c];\n const rawValue = String(dataRow[col.key] ?? '');\n const cellContent = c === 0 ? fullPrefix + rawValue : rawValue;\n const cellText = this._alignText(cellContent, colWidths[c], col.align ?? 'left');\n\n const cellStyle = isSelected\n ? {\n ...attrs,\n bg: { type: 'named' as const, name: 'blue' as const },\n bold: true,\n }\n : isStripe\n ? { ...attrs, bg: this._stripeColor }\n : attrs;\n\n screen.writeString(cx, y + row, cellText, cellStyle);\n cx += colWidths[c];\n if (c < this._columns.length - 1) {\n screen.writeString(cx, y + row, this._separator, {\n ...attrs,\n dim: true,\n bg: isSelected ? { type: 'named', name: 'blue' } : isStripe ? this._stripeColor : attrs.bg,\n });\n cx += sepWidth;\n }\n }\n\n // Fill remaining width for stripe/selection\n if (isSelected || isStripe) {\n const bg: Color = isSelected ? { type: 'named', name: 'blue' as const } : this._stripeColor;\n for (let fx = cx; fx < x + width; fx++) {\n screen.setCell(fx, y + row, { char: ' ', bg });\n }\n }\n\n row++;\n }\n }\n\n private _computeColumnWidths(totalWidth: number): number[] {\n const fixedCols = this._columns.filter(c => c.width !== undefined);\n const flexCols = this._columns.filter(c => c.width === undefined);\n\n let usedWidth = fixedCols.reduce((sum, c) => sum + (c.width ?? 0), 0);\n const remainingWidth = Math.max(0, totalWidth - usedWidth);\n const flexWidth = flexCols.length > 0 ? Math.floor(remainingWidth / flexCols.length) : 0;\n\n return this._columns.map(c => c.width ?? flexWidth);\n }\n\n private _alignText(text: string, width: number, align: 'left' | 'center' | 'right'): string {\n const truncated = truncate(text, width);\n const textWidth = stringWidth(truncated);\n const pad = Math.max(0, width - textWidth);\n\n switch (align) {\n case 'right':\n return ' '.repeat(pad) + truncated;\n case 'center': {\n const left = Math.floor(pad / 2);\n const right = pad - left;\n return ' '.repeat(left) + truncated + ' '.repeat(right);\n }\n case 'left':\n default:\n return truncated + ' '.repeat(pad);\n }\n }\n\n private _buildVisibleRows(): void {\n this._visibleRows = [];\n _collectVisible(this._rows, 0, this._visibleRows);\n }\n\n private _clampScroll(): void {\n const rect = this._getContentRect();\n const headerOffset = this._showHeader ? 2 : 0;\n const visibleHeight = Math.max(1, rect.height - headerOffset);\n\n if (this._selectedIndex < this._scrollOffset) {\n this._scrollOffset = this._selectedIndex;\n }\n if (this._selectedIndex >= this._scrollOffset + visibleHeight) {\n this._scrollOffset = this._selectedIndex - visibleHeight + 1;\n }\n this._scrollOffset = Math.max(0, this._scrollOffset);\n }\n}\n\nfunction _isParent(row: TreeTableRow): boolean {\n return Array.isArray(row.children) && row.children.length > 0;\n}\n\nfunction _collectVisible(\n rows: TreeTableRow[],\n depth: number,\n out: VisibleEntry[],\n): void {\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n out.push({ row, depth });\n if (_isParent(row) && row.expanded) {\n _collectVisible(row.children!, depth + 1, out);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Gauge widget (label + bar + value)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface GaugeOptions {\n /** Color of the filled portion */\n color?: Color;\n /** Show percentage label */\n showLabel?: boolean;\n}\n\n/**\n * Gauge — a self-contained metric display with label, bar, and value.\n *\n * Example:\n * CPU ████████░░░░ 65%\n */\nexport class Gauge extends Widget {\n private _label: string;\n private _value: number = 0;\n private _color: Color;\n private _showLabel: boolean;\n\n constructor(label: string, style: Partial<Style> = {}, opts: GaugeOptions = {}) {\n super(style);\n this._label = label;\n this._color = opts.color ?? { type: 'named', name: 'green' };\n this._showLabel = opts.showLabel ?? true;\n }\n\n setValue(value: number): void {\n this._value = Math.max(0, Math.min(1, value));\n this.markDirty();\n }\n\n getValue(): number {\n return this._value;\n }\n\n setLabel(label: string): void {\n this._label = label;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Layout: \"Label ████████░░░░ XX%\"\n const labelStr = this._label + ' ';\n const percentStr = this._showLabel ? ` ${Math.round(this._value * 100)}%` : '';\n const labelWidth = stringWidth(labelStr);\n const percentWidth = stringWidth(percentStr);\n const barWidth = Math.max(0, width - labelWidth - percentWidth);\n\n // Render label\n screen.writeString(x, y, labelStr, { ...attrs, bold: true });\n\n // Render bar\n const filled = Math.round(barWidth * this._value);\n const barX = x + labelWidth;\n for (let i = 0; i < barWidth; i++) {\n const char = i < filled ? (caps.unicode ? '█' : '#') : (caps.unicode ? '░' : '-');\n screen.setCell(barX + i, y, {\n char,\n fg: i < filled ? this._color : { type: 'named', name: 'brightBlack' },\n });\n }\n\n // Render percentage\n if (this._showLabel) {\n screen.writeString(barX + barWidth, y, percentStr, {\n ...attrs,\n bold: true,\n });\n }\n }\n}\n","import { type Screen, type Style, type Color, styleToCellAttrs, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface LineGaugeOptions {\n /** Filled portion character. Default: '━' with ASCII fallback '=' */\n filledChar?: string;\n\n /** Empty portion character. Default: '─' with ASCII fallback '-' */\n emptyChar?: string;\n\n /** Show percentage label at right. Default: true */\n showLabel?: boolean;\n\n fillColor?: Color;\n emptyColor?: Color;\n}\n\nexport class LineGauge extends Widget {\n private _value = 0;\n private _filledChar: string;\n private _emptyChar: string;\n private _showLabel: boolean;\n private _fillColor?: Color;\n private _emptyColor?: Color;\n\n constructor(style: Partial<Style> = {}, opts: LineGaugeOptions = {}) {\n super(style);\n this._filledChar = opts.filledChar ?? (caps.unicode ? '━' : '=');\n this._emptyChar = opts.emptyChar ?? (caps.unicode ? '─' : '-');\n this._showLabel = opts.showLabel ?? true;\n this._fillColor = opts.fillColor;\n this._emptyColor = opts.emptyColor;\n }\n\n setValue(value: number): void {\n const clamped = Math.max(0, Math.min(1, value));\n if (clamped === this._value) return;\n this._value = clamped;\n this.markDirty();\n }\n\n getValue(): number {\n return this._value;\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const percentStr = this._showLabel ? ` ${Math.round(this._value * 100)}%` : '';\n const percentWidth = stringWidth(percentStr);\n const barWidth = Math.max(0, width - percentWidth);\n const filled = Math.round(barWidth * this._value);\n\n for (let i = 0; i < barWidth; i++) {\n const char = i < filled ? this._filledChar : this._emptyChar;\n screen.setCell(x + i, y, {\n char,\n fg: i < filled\n ? (this._fillColor ?? attrs.fg)\n : (this._emptyColor ?? { type: 'named', name: 'brightBlack' }),\n });\n }\n\n if (this._showLabel) {\n screen.writeString(x + barWidth, y, percentStr, attrs);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Calendar widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, type KeyEvent, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface CalendarOptions {\n date?: Date;\n selectedColor?: Color;\n todayColor?: Color;\n onSelect?: (date: Date) => void;\n}\n\nconst MONTH_NAMES = [\n 'January', 'February', 'March', 'April', 'May', 'June',\n 'July', 'August', 'September', 'October', 'November', 'December'\n];\n\nexport class Calendar extends Widget {\n private _selectedDate: Date;\n private _currentMonth: Date;\n private _selectedColor: Color;\n private _todayColor: Color;\n private _onSelect?: (date: Date) => void;\n focusable = true;\n\n constructor(style: Partial<Style> = {}, opts: CalendarOptions = {}) {\n super(style);\n this._selectedDate = opts.date ? new Date(opts.date) : new Date();\n this._selectedDate.setHours(0, 0, 0, 0);\n\n this._currentMonth = new Date(this._selectedDate.getFullYear(), this._selectedDate.getMonth(), 1);\n this._currentMonth.setHours(0, 0, 0, 0);\n\n this._selectedColor = opts.selectedColor ?? { type: 'named', name: 'cyan' };\n this._todayColor = opts.todayColor ?? { type: 'named', name: 'green' };\n this._onSelect = opts.onSelect;\n }\n\n setMonth(year: number, month: number): void {\n this._currentMonth = new Date(year, month, 1);\n this._currentMonth.setHours(0, 0, 0, 0);\n this.markDirty();\n }\n\n getSelectedDate(): Date {\n return new Date(this._selectedDate);\n }\n\n handleKey(event: KeyEvent): void {\n switch (event.key) {\n case 'left':\n this._moveSelection(-1);\n break;\n case 'right':\n this._moveSelection(1);\n break;\n case 'up':\n this._moveSelection(-7);\n break;\n case 'down':\n this._moveSelection(7);\n break;\n case 'enter':\n this._onSelect?.(new Date(this._selectedDate));\n break;\n }\n }\n\n private _moveSelection(days: number): void {\n const newDate = new Date(this._selectedDate);\n newDate.setDate(newDate.getDate() + days);\n this._selectedDate = newDate;\n\n if (\n newDate.getMonth() !== this._currentMonth.getMonth() ||\n newDate.getFullYear() !== this._currentMonth.getFullYear()\n ) {\n this._currentMonth = new Date(newDate.getFullYear(), newDate.getMonth(), 1);\n this._currentMonth.setHours(0, 0, 0, 0);\n }\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n // Minimum required dimensions to prevent rendering cutoff / overflow\n if (width < 20 || height < 8) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n const year = this._currentMonth.getFullYear();\n const month = this._currentMonth.getMonth();\n\n // 1. Render Month Header (◀ Month Year ▶)\n const prevArrow = caps.unicode ? '◀' : '<';\n const nextArrow = caps.unicode ? '▶' : '>';\n const monthName = MONTH_NAMES[month];\n const title = `${prevArrow} ${monthName} ${year} ${nextArrow}`;\n const titleX = x + Math.floor((width - title.length) / 2);\n screen.writeString(Math.max(x, titleX), y, title, { ...attrs, bold: true });\n\n // 2. Render Weekdays Header\n const weekdays = 'Su Mo Tu We Th Fr Sa';\n const weekdayX = x + Math.floor((width - weekdays.length) / 2);\n screen.writeString(Math.max(x, weekdayX), y + 1, weekdays, { ...attrs, dim: true });\n\n // 3. Render Calendar Grid (Days)\n const daysInMonth = new Date(year, month + 1, 0).getDate();\n const firstDay = new Date(year, month, 1).getDay();\n\n const gridStartY = y + 2;\n const maxWeeks = 6;\n\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n\n for (let w = 0; w < maxWeeks; w++) {\n const rowY = gridStartY + w;\n if (rowY >= y + height) break;\n\n for (let d = 0; d < 7; d++) {\n const colX = Math.max(x, weekdayX) + d * 3;\n if (colX >= x + width) continue;\n\n const dayVal = w * 7 + d - firstDay + 1;\n\n if (dayVal >= 1 && dayVal <= daysInMonth) {\n const label = String(dayVal).padStart(2, ' ');\n const cellDate = new Date(year, month, dayVal);\n cellDate.setHours(0, 0, 0, 0);\n\n const isSelected = cellDate.getTime() === this._selectedDate.getTime();\n const isToday = cellDate.getTime() === today.getTime();\n\n if (isSelected) {\n screen.writeString(colX, rowY, label, {\n ...attrs,\n fg: this._selectedColor,\n bold: true,\n inverse: this.isFocused,\n underline: !this.isFocused,\n });\n } else if (isToday) {\n screen.writeString(colX, rowY, label, {\n ...attrs,\n fg: this._todayColor,\n bold: true,\n });\n } else {\n screen.writeString(colX, rowY, label, attrs);\n }\n } else {\n // Blank spacer for out-of-bounds days\n screen.writeString(colX, rowY, ' ', attrs);\n }\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Sparkline widget (braille chart)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { BrailleCanvas } from './BrailleCanvas.js';\n\nexport interface SparklineOptions {\n /** Color of the sparkline */\n color?: Color;\n\n /** Show min/max labels */\n showRange?: boolean;\n\n /** Rendering style */\n marker?: 'block' | 'braille';\n}\n\n// Sparkline characters (8 levels per cell, bottom to top)\n// Falls back to ASCII digits when unicode is not available.\nconst SPARK_CHARS_UNICODE = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];\nconst SPARK_CHARS_ASCII = ['1', '2', '3', '4', '5', '6', '7', '8'];\n\n/**\n * Sparkline — a compact inline chart showing a data trend.\n *\n * Example:\n * Latency ▂▃▅▇▅▃▂▁▃▅█▅▃\n */\nexport class Sparkline extends Widget {\n private _label: string;\n private _data: number[] = [];\n private _color: Color;\n private _showRange: boolean;\n private _marker: 'block' | 'braille';\n constructor(label: string, style: Partial<Style> = {}, opts: SparklineOptions = {}) {\n super(style);\n this._label = label;\n this._color = opts.color ?? { type: 'named', name: 'cyan' };\n this._showRange = opts.showRange ?? false;\n this._marker = opts.marker ?? 'block';\n }\n\n setData(data: number[]): void {\n this._data = data;\n this.markDirty();\n }\n\n pushValue(value: number): void {\n this._data.push(value);\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const labelStr = this._label + ' ';\n const labelWidth = labelStr.length;\n\n // Render label\n screen.writeString(x, y, labelStr, { ...attrs, bold: true });\n\n // Available sparkline width\n const sparkWidth = width - labelWidth;\n if (sparkWidth <= 0 || this._data.length === 0) return;\n\n // Take the most recent data points that fit\n const data = this._data.slice(-sparkWidth);\n\n // Normalize data to 0–7 range\n const min = Math.min(...data);\n const max = Math.max(...data);\n const range = max - min || 1;\n\n if (caps.unicode && this._marker === 'braille') {\n const canvas = new BrailleCanvas({\n width: sparkWidth * 2,\n height: 4,\n color: this._color,\n });\n\n for (let i = 0; i < data.length; i++) {\n const normalized = (data[i] - min) / range;\n\n const barHeight = Math.max(\n 1,\n Math.ceil(normalized * 4),\n );\n \n for (let py = 0; py < barHeight; py++) {\n canvas.drawPixel(\n i * 2,\n 3 - py,\n );\n\n canvas.drawPixel(\n i * 2 + 1,\n 3 - py,\n );\n }\n }\n\n canvas.updateRect({\n x: x + labelWidth,\n y,\n width: sparkWidth,\n height: 1,\n });\n\n canvas.render(screen);\n\n return;\n}\n\n const sparkChars = caps.unicode ? SPARK_CHARS_UNICODE : SPARK_CHARS_ASCII;\n for (let i = 0; i < data.length; i++) {\n const normalized = (data[i] - min) / range;\n const charIdx = Math.min(7, Math.round(normalized * 7));\n screen.setCell(x + labelWidth + i, y, {\n char: sparkChars[charIdx],\n fg: this._color,\n });\n }\n\n // Optional range labels on second line\n if (this._showRange && height > 1) {\n const rangeStr = `${min.toFixed(0)}–${max.toFixed(0)}`;\n screen.writeString(x + labelWidth, y + 1, rangeStr, {\n ...attrs,\n dim: true,\n });\n }\n }\n}\n","import { type Screen, type Style, type Color, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface BrailleCanvasOptions {\n width: number;\n height: number;\n color?: Color;\n}\n\nconst BRAILLE_BITS = [\n [0x01, 0x08],\n [0x02, 0x10],\n [0x04, 0x20],\n [0x40, 0x80],\n] as const;\n\nexport class BrailleCanvas extends Widget {\n private _canvasWidth: number;\n private _canvasHeight: number;\n private _pixels: boolean[][];\n private _color?: Color;\n\n constructor(\n opts: BrailleCanvasOptions,\n style: Partial<Style> = {},\n ) {\n super(style);\n\n this._canvasWidth = opts.width;\n this._canvasHeight = opts.height;\n this._color = opts.color;\n\n this._pixels = Array.from(\n { length: this._canvasHeight },\n () => Array(this._canvasWidth).fill(false),\n );\n }\n\n drawPixel(x: number, y: number): void {\n if (\n x < 0 ||\n y < 0 ||\n x >= this._canvasWidth ||\n y >= this._canvasHeight\n ) {\n return;\n }\n\n this._pixels[y]![x] = true;\n this.markDirty();\n }\n\n drawLine(\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n ): void {\n \n const dx = Math.abs(x1 - x0);\n const dy = Math.abs(y1 - y0);\n\n const sx = x0 < x1 ? 1 : -1;\n const sy = y0 < y1 ? 1 : -1;\n\n let err = dx - dy;\n\n while (true) {\n this.drawPixel(x0, y0);\n\n if (x0 === x1 && y0 === y1) {\n break;\n }\n\n const e2 = err * 2;\n\n if (e2 > -dy) {\n err -= dy;\n x0 += sx;\n }\n\n if (e2 < dx) {\n err += dx;\n y0 += sy;\n }\n \n }\n this.markDirty();\n}\n \n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n\n if (rect.width <= 0 || rect.height <= 0) {\n return;\n }\n\n const { x, y } = rect;\n\n const cellWidth = Math.ceil(this._canvasWidth / 2);\n const cellHeight = Math.ceil(this._canvasHeight / 4);\n\n for (let cy = 0; cy < cellHeight; cy++) {\n for (let cx = 0; cx < cellWidth; cx++) {\n let pattern = 0;\n\n for (let py = 0; py < 4; py++) {\n for (let px = 0; px < 2; px++) {\n const pixelX = cx * 2 + px;\n const pixelY = cy * 4 + py;\n\n if (\n pixelY < this._canvasHeight &&\n pixelX < this._canvasWidth &&\n this._pixels[pixelY]?.[pixelX]\n ) {\n pattern |= BRAILLE_BITS[py]![px]!;\n }\n }\n }\n\n const char = caps.unicode\n ? String.fromCharCode(0x2800 + pattern)\n : pattern === 0\n ? ' '\n : '#';\n\n screen.setCell(\n x + cx,\n y + cy,\n {\n char,\n fg: this._color,\n },\n );\n }\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — StatusIndicator widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface StatusIndicatorOptions {\n /** Color when up/active */\n upColor?: Color;\n /** Color when down/inactive */\n downColor?: Color;\n}\n\n/**\n * StatusIndicator — simple up/down indicator with label.\n *\n * Example:\n * ● API Server — Online\n * ○ Worker — Offline\n */\nexport class StatusIndicator extends Widget {\n private _label: string;\n private _isUp: boolean;\n private _upColor: Color;\n private _downColor: Color;\n\n constructor(label: string, isUp: boolean, style: Partial<Style> = {}, opts: StatusIndicatorOptions = {}) {\n super(style);\n this._label = label;\n this._isUp = isUp;\n this._upColor = opts.upColor ?? { type: 'named', name: 'green' };\n this._downColor = opts.downColor ?? { type: 'named', name: 'red' };\n }\n\n setStatus(isUp: boolean): void {\n this._isUp = isUp;\n this.markDirty();\n }\n\n getStatus(): boolean {\n return this._isUp;\n }\n\n setLabel(label: string): void {\n this._label = label;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const dot = this._isUp ? '●' : '○';\n const statusText = this._isUp ? 'Online' : 'Offline';\n const color = this._isUp ? this._upColor : this._downColor;\n\n screen.setCell(x, y, { char: dot, fg: color });\n screen.writeString(x + 2, y, `${this._label} — ${statusText}`, {\n ...attrs,\n fg: color,\n });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — BarChart widget\n// Grouped bar chart with vertical and horizontal modes.\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen, type Style, type Color,\n styleToCellAttrs, stringWidth,\n VERTICAL_BAR_SYMBOLS, HORIZONTAL_BAR_SYMBOLS,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n// ── Types ────────────────────────────────────────────\n\nexport interface Bar {\n value: number;\n label?: string;\n color?: Color;\n}\n\nexport interface BarGroup {\n label?: string;\n bars: Bar[];\n}\n\nexport type BarChartDirection = 'vertical' | 'horizontal';\n\nexport interface BarChartOptions {\n /** Direction bars grow. Default: 'vertical'. */\n direction?: BarChartDirection;\n /** Width of each bar in cells. Default: 1. */\n barWidth?: number;\n /** Gap between bars in a group. Default: 1. */\n barGap?: number;\n /** Gap between groups. Default: 2. */\n groupGap?: number;\n /** Max value for scaling. Auto-detected if not set. */\n max?: number;\n /** Color for bars without a per-bar color. */\n barColor?: Color;\n /** Color for value labels. */\n valueColor?: Color;\n /** Color for text labels. */\n labelColor?: Color;\n}\n\n// ── Widget ───────────────────────────────────────────\n\nexport class BarChart extends Widget {\n private _data: BarGroup[] = [];\n private _direction: BarChartDirection;\n private _barWidth: number;\n private _barGap: number;\n private _groupGap: number;\n private _max?: number;\n private _barColor: Color;\n private _valueColor: Color;\n private _labelColor: Color;\n\n constructor(data: BarGroup[], style: Partial<Style> = {}, opts: BarChartOptions = {}) {\n super(style);\n this._data = data;\n this._direction = opts.direction ?? 'vertical';\n this._barWidth = opts.barWidth ?? 1;\n this._barGap = opts.barGap ?? 1;\n this._groupGap = opts.groupGap ?? 2;\n this._max = opts.max;\n this._barColor = opts.barColor ?? { type: 'named', name: 'cyan' };\n this._valueColor = opts.valueColor ?? { type: 'named', name: 'white' };\n this._labelColor = opts.labelColor ?? { type: 'named', name: 'brightBlack' };\n }\n\n setData(data: BarGroup[]): void {\n this._data = data;\n this.markDirty();\n }\n\n setMax(max: number | undefined): void {\n this._max = max;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._data.length === 0) return;\n\n const maxVal = this._computeMax();\n if (maxVal === 0) return;\n\n if (this._direction === 'vertical') {\n this._renderVertical(screen, x, y, width, height, maxVal);\n } else {\n this._renderHorizontal(screen, x, y, width, height, maxVal);\n }\n }\n\n private _computeMax(): number {\n if (this._max !== undefined) return this._max;\n let max = 0;\n for (const group of this._data) {\n for (const bar of group.bars) {\n if (bar.value > max) max = bar.value;\n }\n }\n return max;\n }\n\n // ── Vertical Rendering ───────────────────────────\n\n private _renderVertical(\n screen: Screen, ox: number, oy: number,\n width: number, height: number, maxVal: number,\n ): void {\n const valueRows = 1;\n const hasLabels = this._data.some(g =>\n g.bars.some(b => b.label !== undefined)\n );\n const labelRows = hasLabels ? 1 : 0;\n const hasGroupLabels = this._data.some(g => g.label !== undefined);\n const groupLabelRows = hasGroupLabels ? 1 : 0;\n const reservedRows = valueRows + labelRows + groupLabelRows;\n\n if (height <= reservedRows) return;\n\n const barAreaHeight = height - reservedRows;\n let cx = ox;\n\n for (let gi = 0; gi < this._data.length; gi++) {\n const group = this._data[gi];\n if (!group) continue;\n const groupStartX = cx;\n\n for (let bi = 0; bi < group.bars.length; bi++) {\n const bar = group.bars[bi];\n if (!bar) continue;\n if (cx + this._barWidth > ox + width) break;\n\n const color = bar.color ?? this._barColor;\n\n // Draw bar from bottom up using sub-cell symbols (8 levels per cell)\n const scaledHeight = (bar.value / maxVal) * (barAreaHeight * 8);\n let remaining = Math.round(scaledHeight);\n\n for (let row = barAreaHeight - 1; row >= 0; row--) {\n if (remaining <= 0) break;\n const level = Math.min(remaining, 8);\n const symbol = VERTICAL_BAR_SYMBOLS[level] ?? ' ';\n const cellY = oy + row;\n\n for (let col = 0; col < this._barWidth; col++) {\n const cellX = cx + col;\n if (cellX < ox + width) {\n screen.setCell(cellX, cellY, { char: symbol, fg: color });\n }\n }\n remaining -= 8;\n }\n\n // Value text below bar\n const valStr = Math.round(bar.value).toString();\n const valX = cx + Math.floor((this._barWidth - stringWidth(valStr)) / 2);\n screen.writeString(\n Math.max(cx, valX), oy + barAreaHeight,\n valStr.slice(0, this._barWidth),\n { fg: this._valueColor },\n );\n\n // Bar label below value\n if (hasLabels && bar.label) {\n const label = bar.label.slice(0, this._barWidth);\n const labelX = cx + Math.floor((this._barWidth - stringWidth(label)) / 2);\n screen.writeString(\n Math.max(cx, labelX), oy + barAreaHeight + valueRows,\n label,\n { fg: this._labelColor },\n );\n }\n\n cx += this._barWidth;\n if (bi < group.bars.length - 1) cx += this._barGap;\n }\n\n // Group label at bottom\n if (hasGroupLabels && group.label) {\n const groupWidth = cx - groupStartX;\n const label = group.label.slice(0, groupWidth);\n const labelX = groupStartX + Math.floor((groupWidth - stringWidth(label)) / 2);\n screen.writeString(\n Math.max(groupStartX, labelX), oy + height - 1,\n label,\n { fg: this._labelColor },\n );\n }\n\n if (gi < this._data.length - 1) cx += this._groupGap;\n }\n }\n\n // ── Horizontal Rendering ─────────────────────────\n\n private _renderHorizontal(\n screen: Screen, ox: number, oy: number,\n width: number, height: number, maxVal: number,\n ): void {\n // Compute label column width\n let maxLabelWidth = 0;\n let maxValueWidth = 0;\n for (const group of this._data) {\n for (const bar of group.bars) {\n if (bar.label) {\n const w = stringWidth(bar.label);\n if (w > maxLabelWidth) maxLabelWidth = w;\n }\n const vw = Math.round(bar.value).toString().length;\n if (vw > maxValueWidth) maxValueWidth = vw;\n }\n }\n\n const labelColWidth = maxLabelWidth > 0 ? maxLabelWidth + 1 : 0;\n const valueColWidth = maxValueWidth > 0 ? maxValueWidth + 1 : 0;\n const barAreaWidth = width - labelColWidth - valueColWidth;\n\n if (barAreaWidth <= 0) return;\n\n let cy = oy;\n\n for (let gi = 0; gi < this._data.length; gi++) {\n const group = this._data[gi];\n if (!group) continue;\n\n for (let bi = 0; bi < group.bars.length; bi++) {\n const bar = group.bars[bi];\n if (!bar) continue;\n\n for (let row = 0; row < this._barWidth; row++) {\n const cellY = cy + row;\n if (cellY >= oy + height) break;\n\n // Label on first row\n if (row === 0 && bar.label) {\n const label = bar.label.slice(0, maxLabelWidth);\n const padded = label.padStart(maxLabelWidth);\n screen.writeString(ox, cellY, padded, { fg: this._labelColor });\n }\n\n // Draw horizontal bar using sub-cell symbols\n const color = bar.color ?? this._barColor;\n const scaledWidth = (bar.value / maxVal) * (barAreaWidth * 8);\n let remaining = Math.round(scaledWidth);\n const barStartX = ox + labelColWidth;\n\n for (let col = 0; col < barAreaWidth; col++) {\n if (remaining <= 0) break;\n const level = Math.min(remaining, 8);\n const symbol = HORIZONTAL_BAR_SYMBOLS[level] ?? ' ';\n screen.setCell(barStartX + col, cellY, { char: symbol, fg: color });\n remaining -= 8;\n }\n\n // Value text on first row\n if (row === 0) {\n const valStr = Math.round(bar.value).toString();\n screen.writeString(\n ox + labelColWidth + barAreaWidth, cellY,\n ` ${valStr}`,\n { fg: this._valueColor },\n );\n }\n }\n\n cy += this._barWidth;\n if (bi < group.bars.length - 1) cy += this._barGap;\n }\n\n if (gi < this._data.length - 1) cy += this._groupGap;\n }\n }\n}\n","import { type Screen, type Style, type Color, caps, truncate } from \"@termuijs/core\";\nimport { Widget } from \"../base/Widget.js\";\n\nexport interface HistogramOptions {\n bins?: number;\n barColor?: Color;\n xLabel?: string;\n}\n\nexport class Histogram extends Widget {\n private _values: number[] = [];\n private _bins: number;\n private _barColor: Color;\n private _xLabel?: string;\n\n constructor(style: Partial<Style> = {}, opts: HistogramOptions = {}) {\n super(style);\n\n this._bins = opts.bins ?? 10;\n this._barColor = opts.barColor ?? { type: \"named\", name: \"cyan\" };\n this._xLabel = opts.xLabel;\n }\n\n setData(values: number[]): void {\n this._values = values;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0 || this._values.length === 0) {\n return;\n }\n\n const counts = this._computeBins();\n const maxCount = Math.max(...counts);\n\n if (maxCount === 0) {\n return;\n }\n\n const labelRows = this._xLabel ? 1 : 0;\n const barAreaHeight = height - labelRows;\n\n if (barAreaHeight <= 0) {\n return;\n }\n\n const barWidth = Math.max(1, Math.floor(width / counts.length));\n\n for (let i = 0; i < counts.length; i++) {\n const count = counts[i];\n\n if (count === undefined) {\n continue;\n }\n\n const scaledHeight = Math.round((count / maxCount) * barAreaHeight);\n\n for (let row = 0; row < scaledHeight; row++) {\n for (let col = 0; col < barWidth; col++) {\n const cellX = x + i * barWidth + col;\n\n if (cellX >= x + width) {\n continue;\n }\n\n screen.setCell(cellX, y + barAreaHeight - 1 - row, {\n char: caps.unicode ? \"█\" : \"|\",\n fg: this._barColor,\n });\n }\n }\n }\n\n if (this._xLabel) {\n screen.writeString(\n x,\n y + height - 1,\n truncate(this._xLabel, width),\n {},\n );\n }\n }\n\n private _computeBins(): number[] {\n const counts = Array(this._bins).fill(0);\n\n if (this._values.length === 0) {\n return counts;\n }\n\n const min = Math.min(...this._values);\n const max = Math.max(...this._values);\n\n if (min === max) {\n counts[0] = this._values.length;\n return counts;\n }\n\n const bucketSize = (max - min) / this._bins;\n\n for (const value of this._values) {\n let index = Math.floor((value - min) / bucketSize);\n\n if (index >= this._bins) {\n index = this._bins - 1;\n }\n\n counts[index]++;\n }\n\n return counts;\n }\n}\n","import { type Color, type Screen, type Style, caps, truncate } from \"@termuijs/core\";\nimport { Widget } from \"../base/Widget.js\";\nimport { BrailleCanvas } from \"./BrailleCanvas.js\";\n\nexport interface StackedSeries {\n label: string;\n data: number[];\n color?: Color;\n}\n\nexport interface StackedBarChartOptions {\n categories?: string[];\n barWidth?: number;\n}\n\nexport class StackedBarChart extends Widget {\n private _series: StackedSeries[] = [];\n private _categories: string[];\n private _barWidth: number;\n\n constructor(style: Partial<Style> = {}, opts: StackedBarChartOptions = {}) {\n super(style);\n this._categories = opts.categories ?? [];\n this._barWidth = opts.barWidth ?? 2;\n }\n\n setSeries(series: StackedSeries[]): void {\n this._series = series;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n\n if (width <= 0 || height <= 0 || this._series.length === 0) {\n return;\n }\n\n if (!caps.unicode) {\n this._renderAscii(screen, x, y, width, height);\n return;\n }\n\n this._renderBraille(screen, x, y, width, height);\n }\n\n private _categoryCount(): number {\n return Math.max(\n this._categories.length,\n ...this._series.map((series) => series.data.length),\n );\n }\n\n private _totals(categoryCount: number): number[] {\n return Array.from({ length: categoryCount }, (_, index) =>\n this._series.reduce(\n (sum, series) => sum + Math.max(0, series.data[index] ?? 0),\n 0,\n ),\n );\n }\n\n private _renderBraille(\n screen: Screen,\n x: number,\n y: number,\n width: number,\n height: number,\n ): void {\n const categoryCount = this._categoryCount();\n if (categoryCount === 0) return;\n\n const labelRows = this._categories.length > 0 ? 1 : 0;\n const chartHeight = height - labelRows;\n if (chartHeight <= 0) return;\n\n const totals = this._totals(categoryCount);\n const maxTotal = Math.max(...totals);\n if (maxTotal <= 0) return;\n\n const pixelWidth = width * 2;\n const pixelHeight = chartHeight * 4;\n const gap = 1;\n const barWidth = Math.max(1, this._barWidth);\n const step = barWidth + gap;\n\n this._series.forEach((series, seriesIndex) => {\n const canvas = new BrailleCanvas(\n {\n width: pixelWidth,\n height: pixelHeight,\n color: series.color,\n },\n {},\n );\n\n for (\n let categoryIndex = 0;\n categoryIndex < categoryCount;\n categoryIndex++\n ) {\n const stackBase = this._series\n .slice(0, seriesIndex)\n .reduce(\n (sum, item) =>\n sum + Math.max(0, item.data[categoryIndex] ?? 0),\n 0,\n );\n\n const value = Math.max(0, series.data[categoryIndex] ?? 0);\n const start = Math.round((stackBase / maxTotal) * pixelHeight);\n const end = Math.round(\n ((stackBase + value) / maxTotal) * pixelHeight,\n );\n const startX = categoryIndex * step;\n\n for (\n let px = startX;\n px < startX + barWidth && px < pixelWidth;\n px++\n ) {\n for (let py = start; py < end; py++) {\n canvas.drawPixel(px, pixelHeight - 1 - py);\n }\n }\n }\n\n canvas.updateRect({ x, y, width, height: chartHeight });\n canvas.render(screen);\n });\n\n this._renderLabels(screen, x, y + chartHeight, width);\n }\n\n private _renderAscii(\n screen: Screen,\n x: number,\n y: number,\n width: number,\n height: number,\n ): void {\n const categoryCount = this._categoryCount();\n if (categoryCount === 0) return;\n\n const labelRows = this._categories.length > 0 ? 1 : 0;\n const chartHeight = height - labelRows;\n if (chartHeight <= 0) return;\n\n const totals = this._totals(categoryCount);\n const maxTotal = Math.max(...totals);\n if (maxTotal <= 0) return;\n\n const gap = 1;\n const barWidth = Math.max(1, this._barWidth);\n const step = barWidth + gap;\n\n for (\n let categoryIndex = 0;\n categoryIndex < categoryCount;\n categoryIndex++\n ) {\n let stackBase = 0;\n\n for (const series of this._series) {\n const value = Math.max(0, series.data[categoryIndex] ?? 0);\n const start = Math.round((stackBase / maxTotal) * chartHeight);\n const end = Math.round(\n ((stackBase + value) / maxTotal) * chartHeight,\n );\n const startX = x + categoryIndex * step;\n\n for (let col = 0; col < barWidth; col++) {\n const cellX = startX + col;\n if (cellX >= x + width) continue;\n\n for (let row = start; row < end; row++) {\n const cellY = y + chartHeight - 1 - row;\n screen.setCell(cellX, cellY, {\n char: \"|\",\n fg: series.color,\n });\n }\n }\n\n stackBase += value;\n }\n }\n\n this._renderLabels(screen, x, y + chartHeight, width);\n }\n\n private _renderLabels(\n screen: Screen,\n x: number,\n y: number,\n width: number,\n ): void {\n if (this._categories.length === 0) return;\n\n const gap = 1;\n const barWidth = Math.max(1, this._barWidth);\n const step = barWidth + gap;\n\n this._categories.forEach((category, index) => {\n const labelX = x + index * step;\n if (labelX >= x + width) return;\n\n screen.writeString(labelX, y, truncate(category, barWidth), {});\n });\n }\n}\n","import {\n type Screen,\n type Style,\n type Color,\n styleToCellAttrs,\n stringWidth,\n HORIZONTAL_BAR_SYMBOLS,\n caps,\n} from \"@termuijs/core\";\nimport { Widget } from \"../base/Widget.js\";\n\nexport interface GanttTask {\n label?: string;\n start: number;\n duration: number;\n color?: Color;\n}\n\nexport interface GanttChartOptions {\n taskHeight?: number;\n taskGap?: number;\n minTime?: number;\n maxTime?: number;\n barColor?: Color;\n labelColor?: Color;\n}\n\nexport class GanttChart extends Widget {\n private _tasks: GanttTask[] = [];\n private _taskHeight: number;\n private _taskGap: number;\n private _minTime?: number;\n private _maxTime?: number;\n private _barColor: Color;\n private _labelColor: Color;\n\n constructor(\n tasks: GanttTask[],\n style: Partial<Style> = {},\n opts: GanttChartOptions = {}\n ) {\n super(style);\n this._tasks = tasks;\n this._taskHeight = opts.taskHeight ?? 1;\n this._taskGap = opts.taskGap ?? 1;\n this._minTime = opts.minTime;\n this._maxTime = opts.maxTime;\n this._barColor = opts.barColor ?? { type: \"named\", name: \"cyan\" };\n this._labelColor = opts.labelColor ?? { type: \"named\", name: \"brightBlack\" };\n }\n\n setTasks(tasks: GanttTask[]): void {\n this._tasks = tasks;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0 || this._tasks.length === 0) return;\n\n let minT = this._minTime;\n let maxT = this._maxTime;\n\n // Auto-calculate bounds if missing\n if (minT === undefined || maxT === undefined) {\n let calculatedMin = Infinity;\n let calculatedMax = -Infinity;\n\n for (const task of this._tasks) {\n if (task.start < calculatedMin) calculatedMin = task.start;\n const end = task.start + task.duration;\n if (end > calculatedMax) calculatedMax = end;\n }\n\n if (minT === undefined) minT = calculatedMin === Infinity ? 0 : calculatedMin;\n if (maxT === undefined) maxT = calculatedMax === -Infinity ? 100 : calculatedMax;\n }\n\n const timeSpan = maxT - minT;\n if (timeSpan <= 0) return; // Degenerate span, can't map width\n\n // Calculate maximum label width\n let maxLabelWidth = 0;\n for (const task of this._tasks) {\n if (task.label) {\n const w = stringWidth(task.label);\n if (w > maxLabelWidth) maxLabelWidth = w;\n }\n }\n\n const labelColWidth = maxLabelWidth > 0 ? maxLabelWidth + 1 : 0;\n const barAreaWidth = width - labelColWidth;\n\n if (barAreaWidth <= 0) return; // No space for bars\n\n let currentY = y;\n\n for (let i = 0; i < this._tasks.length; i++) {\n const task = this._tasks[i];\n\n // Prevent rendering past widget height bounds\n if (currentY >= y + height) break;\n\n for (let row = 0; row < this._taskHeight; row++) {\n const cellY = currentY + row;\n if (cellY >= y + height) break;\n\n // Render label only on the first row of a task\n if (row === 0 && task.label) {\n // Truncate by column width (not codepoints) to handle multi-byte chars\n let truncated = '';\n let cols = 0;\n for (const ch of task.label) {\n const w = stringWidth(ch);\n if (cols + w > maxLabelWidth) break;\n truncated += ch;\n cols += w;\n }\n // Pad with spaces to fill maxLabelWidth columns\n const padded = truncated + ' '.repeat(maxLabelWidth - stringWidth(truncated));\n screen.writeString(x, cellY, padded, { fg: this._labelColor });\n }\n\n // Calculate bar geometry using sub-cell precision\n const color = task.color ?? this._barColor;\n \n // Find start column relative to bar area\n // Clamp it to 0 just in case start < minT\n const startOffsetVal = Math.max(0, task.start - minT);\n const startCols = (startOffsetVal / timeSpan) * barAreaWidth;\n const startColInt = Math.floor(startCols);\n \n // Find duration width\n const durWidth = (task.duration / timeSpan) * barAreaWidth;\n \n // Total sub-cells scaled (8 levels per cell)\n let remainingSubCells = Math.round(durWidth * 8);\n\n const barStartX = x + labelColWidth + startColInt;\n\n for (let col = 0; col < barAreaWidth - startColInt; col++) {\n if (remainingSubCells <= 0) break;\n const level = Math.min(remainingSubCells, 8);\n let symbol = HORIZONTAL_BAR_SYMBOLS[level] ?? \" \";\n if (!caps.unicode && level > 0) {\n symbol = level === 8 ? \"=\" : \"-\";\n }\n screen.setCell(barStartX + col, cellY, { char: symbol, fg: color });\n remainingSubCells -= 8;\n }\n }\n\n currentY += this._taskHeight;\n if (i < this._tasks.length - 1) currentY += this._taskGap;\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Grid layout widget\n// ─────────────────────────────────────────────────────\n\nimport type { Screen, Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { Box } from '../display/Box.js';\n\nexport interface GridOptions {\n /** Number of equal-width columns */\n columns: number;\n /** Gap between items in both directions (default: 1) */\n gap?: number;\n /** Row gap override (overrides gap for rows) */\n rowGap?: number;\n /** Column gap override (overrides gap for columns) */\n colGap?: number;\n}\n\n/**\n * Grid — a CSS-Grid-like layout widget.\n *\n * Items fill left-to-right, wrapping to a new row every `columns` items.\n * Internally creates a column-flex Box per row, each with equal-flex-grow items.\n *\n * The `addChild()` override means the reconciler's generic child-adding\n * loop works without any special casing.\n */\nexport class Grid extends Widget {\n private _columns: number;\n private _colGap: number;\n private _rowGap: number;\n private _rows: Box[] = [];\n private _itemCount: number = 0;\n\n constructor(style: Partial<Style>, options: GridOptions) {\n super({ flexDirection: 'column', ...style });\n this._columns = Math.max(1, options.columns);\n const gap = options.gap ?? 1;\n this._colGap = options.colGap ?? gap;\n this._rowGap = options.rowGap ?? gap;\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Grid is a pure layout container — no self-rendering needed.\n }\n\n /**\n * Add a widget to the grid. Items fill left-to-right,\n * wrapping to a new row automatically every `columns` items.\n * Overrides Widget.addChild so the reconciler generic loop works unchanged.\n */\n override addChild(widget: Widget): void {\n const rowIndex = Math.floor(this._itemCount / this._columns);\n\n // Create a new row Box if needed\n if (rowIndex >= this._rows.length) {\n const rowStyle: Partial<Style> = { flexDirection: 'row' };\n if (this._colGap > 0) rowStyle.gap = this._colGap;\n // Add row gap as margin-top on rows after the first\n if (this._rows.length > 0 && this._rowGap > 0) {\n rowStyle.margin = this._rowGap;\n }\n const row = new Box(rowStyle);\n this._rows.push(row);\n // Register the row as a child of this widget\n super.addChild(row);\n }\n\n // Add item to the current row with equal flex growth\n const currentRow = this._rows[rowIndex];\n widget.setStyle({ flexGrow: 1 });\n currentRow.addChild(widget);\n this._itemCount++;\n }\n\n /** Add an item explicitly (alias for addChild) */\n addItem(widget: Widget): void {\n this.addChild(widget);\n }\n\n /** Remove all items and reset the grid */\n clearItems(): void {\n // Unmount and detach every row\n for (const row of this._rows) {\n row.unmount();\n row.parent = null;\n }\n this._children = [];\n this._rows = [];\n this._itemCount = 0;\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ScrollView widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type KeyEvent, normalizeNavigationKey } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { ScrollAcceleration } from './scroll-acceleration.js';\n\n\nexport interface ScrollViewOptions {\n /** Total height of content in rows */\n contentHeight?: number;\n /** Show scrollbar indicator on right edge */\n showScrollbar?: boolean;\n /** Whether to use scroll acceleration */\n scrollAccel?: boolean;\n}\n\n/**\n * ScrollView — a height-bounded scrollable container.\n *\n * Children are rendered with a vertical offset applied (scrolling).\n * Responds to up/down arrow keys and Page Up/Page Down.\n */\nexport class ScrollView extends Widget {\n private _scrollOffset: number = 0;\n private _contentHeight: number;\n private _showScrollbar: boolean;\n private _scrollAccel: boolean;\n private _acceleration = new ScrollAcceleration();\n \n\n constructor(style: Partial<Style> = {}, opts: ScrollViewOptions = {}) {\n super({ overflow: 'hidden', ...style });\n this._contentHeight = opts.contentHeight ?? 0;\n this._showScrollbar = opts.showScrollbar ?? true;\n this._scrollAccel = opts.scrollAccel ?? false;\n this.focusable = true;\n }\n\n /** Set the total content height (in rows) */\n setContentHeight(h: number): void {\n if (this._contentHeight === h) return;\n\n this._contentHeight = h;\n this._clampOffset();\n this.markDirty();\n }\n\n /** Get current scroll offset */\n get scrollOffset(): number { return this._scrollOffset; }\n\n /** Scroll by delta rows */\n scrollBy(delta: number): void {\n this._scrollOffset = Math.round(this._scrollOffset + delta);\n this._clampOffset();\n this.markDirty();\n }\n\n /** Scroll to absolute offset */\n scrollTo(offset: number): void {\n const previousOffset = this._scrollOffset;\n \n this._scrollOffset = Math.round(offset);\n this._clampOffset();\n \n if (previousOffset !== this._scrollOffset) {\n this.markDirty();\n }\n }\n\n private _clampOffset(): void {\n const viewHeight = this._rect.height;\n const maxOffset = Math.max(0, this._contentHeight - viewHeight);\n this._scrollOffset = Math.max(0, Math.min(this._scrollOffset, maxOffset));\n }\n \n private getScrollDelta(baseDelta: number): number {\n if (!this._scrollAccel) {\n return baseDelta;\n }\n\n const multiplier =\n this._acceleration.getMultiplier(\n Date.now()\n );\n\n return baseDelta * multiplier; \n}\n /** Handle keyboard navigation */\n handleKey(event: KeyEvent): void {\n switch (normalizeNavigationKey(event.key)) {\n case 'up': this.scrollBy(-this.getScrollDelta(1)); break;\n case 'down': this.scrollBy(this.getScrollDelta(1)); break;\n case 'pageup': this.scrollBy(-this.getScrollDelta(Math.max(1, this._rect.height - 1))); break;\n case 'pagedown': this.scrollBy(this.getScrollDelta(Math.max(1, this._rect.height - 1))); break;\n }\n }\n\n override render(screen: Screen): void {\n if (this._style.visible === false) return;\n\n const shouldClip = true;\n if (shouldClip) screen.pushClip(this._rect);\n\n this._renderSelf(screen);\n this._renderBorder(screen);\n\n // Render children with a Y offset for scrolling\n const rect = this._getContentRect();\n screen.pushTranslateY(-this._scrollOffset);\n for (const child of this._children) {\n child.render(screen);\n }\n screen.popTranslateY();\n\n if (shouldClip) screen.popClip();\n\n // Draw scrollbar on top (outside clip)\n if (this._showScrollbar && this._contentHeight > this._rect.height) {\n this._renderScrollbar(screen, rect);\n }\n }\n\n private _renderScrollbar(screen: Screen, contentRect: { x: number; y: number; width: number; height: number }): void {\n const { y, width, height } = contentRect;\n const scrollX = contentRect.x + width; // right edge of content\n if (scrollX >= this._rect.x + this._rect.width) return;\n\n const trackHeight = height;\n const thumbSize = Math.max(1, Math.round((height / this._contentHeight) * trackHeight));\n const maxOffset = Math.max(1, this._contentHeight - height);\n const thumbPos = Math.round((this._scrollOffset / maxOffset) * (trackHeight - thumbSize));\n\n const attrs = styleToCellAttrs(this._style);\n const thumbChar = '█';\n const trackChar = '░';\n\n for (let i = 0; i < trackHeight; i++) {\n const isThumb = i >= thumbPos && i < thumbPos + thumbSize;\n screen.setCell(scrollX, y + i, {\n char: isThumb ? thumbChar : trackChar,\n ...attrs,\n dim: !isThumb,\n });\n }\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Container only\n }\n}\n","export class ScrollAcceleration {\n private lastScrollTime: number | null = null;\n\n getMultiplier(now: number): number {\n if (this.lastScrollTime === null) {\n this.lastScrollTime = now;\n return 1;\n }\n\n const deltaMs = now - this.lastScrollTime;\n this.lastScrollTime = now;\n\n if (deltaMs > 300) return 1;\n if (deltaMs > 200) return 2;\n if (deltaMs > 100) return 3;\n if (deltaMs > 50) return 4;\n if (deltaMs > 25) return 5;\n\n return 6;\n }\n\n reset(): void {\n this.lastScrollTime = null;\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Center widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface CenterOptions {\n /** Center horizontally (default: true) */\n horizontal?: boolean;\n /** Center vertically (default: true) */\n vertical?: boolean;\n}\n\n/**\n * Center — centers a single child widget horizontally and/or vertically.\n *\n * Computes centering offsets at render time from the child's measured size.\n */\nexport class Center extends Widget {\n private _horizontal: boolean;\n private _vertical: boolean;\n\n constructor(style: Partial<Style> = {}, opts: CenterOptions = {}) {\n super(style);\n this._horizontal = opts.horizontal ?? true;\n this._vertical = opts.vertical ?? true;\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Pure layout container — no self-rendering\n }\n\n override render(screen: Screen): void {\n if (this._style.visible === false) return;\n\n const shouldClip = this._style.overflow !== 'visible';\n if (shouldClip) screen.pushClip(this._rect);\n\n this._renderSelf(screen);\n this._renderBorder(screen);\n\n const content = this._getContentRect();\n\n for (const child of this._children) {\n const childRect = child.rect;\n const origRect = { ...childRect };\n\n let offsetX = content.x;\n let offsetY = content.y;\n\n if (this._horizontal) {\n offsetX = content.x + Math.max(0, Math.floor((content.width - childRect.width) / 2));\n }\n if (this._vertical) {\n offsetY = content.y + Math.max(0, Math.floor((content.height - childRect.height) / 2));\n }\n\n // Access protected _rect to temporarily modify for centering\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (child as any)._rect = {\n x: offsetX,\n y: offsetY,\n width: childRect.width,\n height: childRect.height,\n };\n child.render(screen);\n // Restore original rect after rendering\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (child as any)._rect = origRect;\n }\n\n if (shouldClip) screen.popClip();\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Card widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface CardOptions {\n /** Optional title shown in the top border */\n title?: string;\n /** Color for the border and title */\n borderColor?: Color;\n}\n\n/**\n * Card — a bordered container with an optional title in the top border.\n *\n * Like a Box with border + padding, but supports embedding a title string\n * directly in the top border line.\n */\nexport class Card extends Widget {\n private _title: string;\n private _borderColor?: Color;\n\n constructor(style: Partial<Style> = {}, opts: CardOptions = {}) {\n super({\n border: 'single',\n padding: 1,\n ...style,\n });\n this._title = opts.title ?? '';\n this._borderColor = opts.borderColor;\n }\n\n setTitle(title: string): void {\n this._title = title;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n if (!this._title) return;\n\n const { x, y, width } = this._rect;\n if (width < 4) return;\n\n const attrs = styleToCellAttrs(this._style);\n const fg = this._borderColor ?? attrs.fg;\n\n // Title rendered into top border: ─ Title ─\n const titleText = ` ${this._title} `;\n const titleWidth = stringWidth(titleText);\n const innerWidth = width - 2; // minus corners\n if (titleWidth > innerWidth) return;\n\n const titleX = x + 1 + Math.floor((innerWidth - titleWidth) / 2);\n screen.writeString(titleX, y, titleText, { fg, bold: true });\n }\n}\n","import { Widget } from '../base/Widget.js';\nimport { type Screen, type Style } from '@termuijs/core';\n\nexport interface MasonryOptions {\n /** Number of columns. Default: 2 */\n columns?: number;\n /** Vertical gap between items. Default: 0 */\n gap?: number;\n}\n\nexport class Masonry extends Widget {\n private _columns: number;\n private _gap: number;\n\n constructor(\n children: Widget[],\n style?: Partial<Style>,\n opts?: MasonryOptions,\n ) {\n super(style);\n this._columns = opts?.columns ?? 2;\n this._gap = opts?.gap ?? 0;\n this.setChildren(children);\n }\n\n setChildren(children: Widget[]): void {\n this.clearChildren();\n for (const child of children) this.addChild(child);\n this._layout();\n this.markDirty();\n }\n\n override syncLayout(): void {\n super.syncLayout();\n this._layout();\n }\n\n protected _renderSelf(_screen: Screen): void {}\n\n private _layout(): void {\n const totalWidth = this.rect.width || 80;\n const colWidth = Math.floor(totalWidth / this._columns);\n const colHeights = new Array<number>(this._columns).fill(0);\n\n for (const child of this.children) {\n const col = colHeights.indexOf(Math.min(...colHeights));\n const x = col * colWidth;\n const y = colHeights[col];\n // preferredHeight is a test-only property set by test helper\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const height = (child as any).preferredHeight ?? (child.rect.height || 1);\n\n child.updateRect({ x, y, width: colWidth, height });\n\n colHeights[col] += height + this._gap;\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Columns widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { Box } from '../display/Box.js';\n\nexport interface ColumnsOptions {\n /** Gap between columns in cells (default: 1) */\n gap?: number;\n}\n\n/**\n * Columns — splits available width evenly across child widgets.\n *\n * Children are laid out side-by-side with equal flex-grow.\n * Internally uses a flex-row Box; the addChild override applies\n * flexGrow:1 to each child so the reconciler's generic loop works.\n */\nexport class Columns extends Widget {\n private _inner: Box;\n\n constructor(style: Partial<Style> = {}, opts: ColumnsOptions = {}) {\n super(style);\n this._inner = new Box({\n flexDirection: 'row',\n gap: opts.gap ?? 1,\n width: '100%',\n height: '100%',\n });\n super.addChild(this._inner);\n }\n\n override addChild(widget: Widget): void {\n widget.setStyle({ flexGrow: 1 });\n this._inner.addChild(widget);\n }\n\n override removeChild(widget: Widget): void {\n this._inner.removeChild(widget);\n }\n\n override clearChildren(): void {\n this._inner.clearChildren();\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Pure layout container\n }\n}\n","import type { Screen, Style, Rect } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type DockEdge = 'top' | 'right' | 'bottom' | 'left' | 'fill';\n\nexport interface DockItem {\n widget: Widget;\n edge: DockEdge;\n size?: number;\n}\n\nexport interface DockOptions {\n style?: Partial<Style>;\n}\n\nexport class Dock extends Widget {\n private _items: DockItem[];\n\n constructor(items: DockItem[], style: Partial<Style> = {}) {\n super(style);\n this._items = items;\n for (const { widget } of items) {\n widget.parent = this;\n }\n }\n\n setItems(items: DockItem[]): void {\n this._items = items;\n for (const { widget } of items) {\n widget.parent = this;\n }\n this.markDirty();\n }\n\n override updateRect(rect: Rect): void {\n super.updateRect(rect);\n\n let top = rect.y;\n let bottom = rect.y + rect.height;\n let left = rect.x;\n let right = rect.x + rect.width;\n\n for (const { widget, edge, size } of this._items) {\n if (edge === 'top') {\n const h = size ?? 1;\n widget.updateRect({ x: left, y: top, width: right - left, height: h });\n top += h;\n } else if (edge === 'bottom') {\n const h = size ?? 1;\n bottom -= h;\n widget.updateRect({ x: left, y: bottom, width: right - left, height: h });\n } else if (edge === 'left') {\n const w = size ?? 1;\n widget.updateRect({ x: left, y: top, width: w, height: bottom - top });\n left += w;\n } else if (edge === 'right') {\n const w = size ?? 1;\n right -= w;\n widget.updateRect({ x: right, y: top, width: w, height: bottom - top });\n } else if (edge === 'fill') {\n widget.updateRect({ x: left, y: top, width: right - left, height: bottom - top });\n }\n }\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Pure layout container — no self-rendering needed.\n }\n\n override render(screen: Screen): void {\n super.render(screen);\n for (const { widget } of this._items) {\n widget.render(screen);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Divider widget\n// Renders a horizontal or vertical line with optional label\n// ─────────────────────────────────────────────────────\nimport {\n type Screen,\n type Style,\n type Color,\n styleToCellAttrs,\n stringWidth,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type DividerOrientation = 'horizontal' | 'vertical';\n\nexport interface DividerOptions {\n /** Direction of the divider line */\n orientation?: DividerOrientation;\n /** Optional centered label inside the line */\n label?: string;\n /** Character used to draw the line (overrides default) */\n char?: string;\n /** Color of the line */\n color?: Color;\n}\n\n/**\n * Divider — a horizontal or vertical separator line with optional label.\n *\n * Examples:\n * ──────────────── Stats ──────────────── (horizontal with label)\n * ──────────────────────────────────────── (horizontal)\n * │ (vertical, repeating down the height)\n */\nexport class Divider extends Widget {\n private _orientation: DividerOrientation;\n private _label: string;\n private _char: string | undefined;\n private _color: Color | undefined;\n\n constructor(style: Partial<Style> = {}, opts: DividerOptions = {}) {\n super(style);\n this._orientation = opts.orientation ?? 'horizontal';\n this._label = opts.label ?? '';\n this._char = opts.char;\n this._color = opts.color;\n }\n\n setLabel(label: string): void {\n this._label = label;\n this.markDirty();\n }\n\n setOrientation(orientation: DividerOrientation): void {\n this._orientation = orientation;\n this.markDirty();\n }\n\n setChar(char: string): void {\n this._char = char;\n this.markDirty();\n }\n\n setColor(color: Color): void {\n this._color = color;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const cellAttrs = this._color\n ? { ...attrs, fg: this._color }\n : attrs;\n\n if (this._orientation === 'horizontal') {\n this._renderHorizontal(screen, x, y, width, cellAttrs);\n } else {\n this._renderVertical(screen, x, y, height, cellAttrs);\n }\n }\n\n private _renderHorizontal(\n screen: Screen,\n x: number,\n y: number,\n width: number,\n attrs: ReturnType<typeof styleToCellAttrs>,\n ): void {\n const lineChar = this._char ?? (caps.unicode ? '─' : '-');\n\n if (!this._label) {\n // Simple full-width line\n for (let i = 0; i < width; i++) {\n screen.setCell(x + i, y, { char: lineChar, ...attrs });\n }\n return;\n }\n\n // Centered label: ─── Label ───\n const labelWithPad = ` ${this._label} `;\n const labelWidth = stringWidth(labelWithPad);\n\n if (labelWidth >= width) {\n // Not enough room — just write the label truncated\n screen.writeString(x, y, labelWithPad.slice(0, width), attrs);\n return;\n }\n\n const leftLen = Math.floor((width - labelWidth) / 2);\n const rightLen = width - labelWidth - leftLen;\n\n // Left line\n for (let i = 0; i < leftLen; i++) {\n screen.setCell(x + i, y, { char: lineChar, ...attrs });\n }\n\n // Label\n screen.writeString(x + leftLen, y, labelWithPad, attrs);\n\n // Right line\n for (let i = 0; i < rightLen; i++) {\n screen.setCell(x + leftLen + labelWidth + i, y, {\n char: lineChar,\n ...attrs,\n });\n }\n }\n\n private _renderVertical(\n screen: Screen,\n x: number,\n y: number,\n height: number,\n attrs: ReturnType<typeof styleToCellAttrs>,\n ): void {\n const lineChar = this._char ?? (caps.unicode ? '│' : '|');\n\n for (let i = 0; i < height; i++) {\n screen.setCell(x, y + i, { char: lineChar, ...attrs });\n }\n }\n}","import { type Screen, type Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface AspectRatioOptions {\n /** Width:height ratio */\n ratio?: number;\n\n /** contain = fit inside, cover = fill */\n fit?: 'contain' | 'cover';\n}\n\nexport class AspectRatio extends Widget {\n private _ratio: number;\n private _fit: 'contain' | 'cover';\n\n constructor(\n child: Widget,\n style: Partial<Style> = {},\n opts: AspectRatioOptions = {},\n ) {\n super(style);\n\n this._ratio = opts.ratio ?? 2;\n this._fit = opts.fit ?? 'contain';\n\n this.addChild(child);\n }\n\n setChild(child: Widget): void {\n this.clearChildren();\n this.addChild(child);\n this.markDirty();\n }\n\n protected _renderSelf(_screen: Screen): void {\n // Pure layout widget\n }\n\n override render(screen: Screen): void {\n if (this._style.visible === false) return;\n\n const shouldClip = this._style.overflow !== 'visible';\n\n if (shouldClip) {\n screen.pushClip(this._rect);\n }\n\n this._renderSelf(screen);\n this._renderBorder(screen);\n\n const content = this._getContentRect();\n\n for (const child of this._children) {\n const originalRect = { ...child.rect };\n\n const targetHeight = Math.round(\n content.width / this._ratio,\n );\n\n const childHeight =\n this._fit === 'contain'\n ? Math.min(content.height, targetHeight)\n : content.height;\n\n const childY =\n content.y +\n Math.floor(\n (content.height - childHeight) / 2,\n );\n\n (child as any)._rect = { // as any: _rect is protected; no public API for temporary rect override during measurement\n x: content.x,\n y: childY,\n width: content.width,\n height: childHeight,\n };\n\n child.render(screen);\n\n (child as any)._rect = originalRect; // as any: _rect is protected; no public API for temporary rect override during measurement\n }\n\n if (shouldClip) {\n screen.popClip();\n }\n }\n}","import { type Screen, type Style, type Color } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface FillOptions {\n char?: string;\n color?: Color;\n}\n\nexport class Fill extends Widget {\n private _char: string;\n private _color?: Color;\n\n constructor(style: Partial<Style> = {}, opts: FillOptions = {}) {\n super(style);\n this._char = opts.char ?? ' ';\n this._color = opts.color;\n }\n\n setChar(char: string): void {\n this._char = char;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n\n if (width <= 0 || height <= 0) return;\n\n for (let row = y; row < y + height; row++) {\n for (let col = x; col < x + width; col++) {\n screen.setCell(col, row, {\n char: this._char,\n fg: this._color,\n });\n }\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — SplitPane layout widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type KeyEvent, caps, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface SplitPaneOptions {\n /** Horizontal split ratio for the left pane (0–1, default: 0.5) */\n ratio?: number;\n /** Minimum width in cells for each pane (default: 1) */\n minSize?: number;\n}\n\n/**\n * SplitPane — two-pane horizontal layout with a draggable divider.\n *\n * The left pane occupies columns [0, leftWidth − 1], the divider sits at\n * leftWidth, and the right pane occupies [leftWidth + 1, totalWidth − 1].\n * Use shift+left / shift+right to resize when focused.\n */\nexport class SplitPane extends Widget {\n private _ratio: number;\n private readonly _minSize: number;\n\n constructor(\n left: Widget,\n right: Widget,\n style: Partial<Style> = {},\n opts: SplitPaneOptions = {},\n ) {\n super(style);\n this._ratio = opts.ratio ?? 0.5;\n this._minSize = opts.minSize ?? 1;\n this.focusable = true;\n this.addChild(left);\n this.addChild(right);\n }\n\n getRatio(): number {\n return this._ratio;\n }\n\n setRatio(ratio: number): void {\n const totalWidth = this._getContentRect().width;\n this._ratio = totalWidth > 0 ? this._clampRatio(ratio, totalWidth) : ratio;\n this.markDirty();\n }\n\n handleKey(event: KeyEvent): void {\n if (!event.shift) return;\n\n const totalWidth = this._getContentRect().width;\n if (totalWidth <= 0) return;\n\n const step = 1 / totalWidth;\n if (event.key === 'left') {\n this.setRatio(this._ratio - step);\n } else if (event.key === 'right') {\n this.setRatio(this._ratio + step);\n }\n }\n\n override syncLayout(): void {\n super.syncLayout();\n this._positionChildren();\n }\n\n protected _renderSelf(screen: Screen): void {\n const content = this._getContentRect();\n const { x, y, width, height } = content;\n if (width <= 0 || height <= 0) return;\n\n const leftWidth = Math.floor(this._ratio * width);\n const dividerX = x + leftWidth;\n const dividerChar = caps.unicode ? '│' : '|';\n const attrs = styleToCellAttrs(this._style);\n\n for (let row = 0; row < height; row++) {\n screen.setCell(dividerX, y + row, { char: dividerChar, ...attrs });\n }\n }\n\n private _clampRatio(ratio: number, totalWidth: number): number {\n const minRatio = this._minSize / totalWidth;\n const maxRatio = 1 - this._minSize / totalWidth;\n return Math.max(minRatio, Math.min(maxRatio, ratio));\n }\n\n private _positionChildren(): void {\n const left = this._children[0];\n const right = this._children[1];\n if (!left || !right) return;\n\n const content = this._getContentRect();\n const totalWidth = content.width;\n if (totalWidth <= 0) return;\n\n const leftWidth = Math.floor(this._ratio * totalWidth);\n\n left.updateRect({\n x: content.x,\n y: content.y,\n width: leftWidth,\n height: content.height,\n });\n\n right.updateRect({\n x: content.x + leftWidth + 1,\n y: content.y,\n width: Math.max(0, totalWidth - leftWidth - 1),\n height: content.height,\n });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ProgressBar widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type Color, caps, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface ProgressBarOptions {\n /** Current value (0–1) */\n value?: number;\n /** Character for the filled portion */\n fillChar?: string;\n /** Character for the empty portion */\n emptyChar?: string;\n /** Color of the filled portion */\n fillColor?: Color;\n /** Show percentage label */\n showLabel?: boolean;\n /** Label format: 'percent' | 'fraction' | 'custom' */\n labelFormat?: 'percent' | 'fraction';\n /** Total for fraction display */\n total?: number;\n}\n\n/**\n * ProgressBar — horizontal progress indicator.\n *\n * Supports:\n * - Configurable fill/empty characters\n * - Custom fill color\n * - Percentage or fraction label\n * - Smooth animation-ready value changes\n */\nexport class ProgressBar extends Widget {\n private _value: number;\n private _fillChar: string;\n private _emptyChar: string;\n private _fillColor: Color;\n private _showLabel: boolean;\n private _labelFormat: 'percent' | 'fraction';\n private _total: number;\n\n constructor(style: Partial<Style> = {}, options: ProgressBarOptions = {}) {\n super({ height: 1, ...style });\n this._value = Math.max(0, Math.min(1, options.value ?? 0));\n this._fillChar = options.fillChar ?? (caps.unicode ? '█' : '#');\n this._emptyChar = options.emptyChar ?? (caps.unicode ? '░' : '-');\n this._fillColor = options.fillColor ?? { type: 'named', name: 'green' };\n this._showLabel = options.showLabel ?? true;\n this._labelFormat = options.labelFormat ?? 'percent';\n this._total = options.total ?? 100;\n }\n\n /** Set progress value (0–1) */\n setValue(value: number): void {\n const normalized = Math.max(0, Math.min(1, value));\n \n if (this._value === normalized) {\n return;\n }\n \n this._value = normalized;\n this.markDirty();\n }\n\n get value(): number { return this._value; }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Label\n let label = '';\n if (this._showLabel) {\n if (this._labelFormat === 'percent') {\n label = ` ${Math.round(this._value * 100)}%`;\n } else {\n label = ` ${Math.round(this._value * this._total)}/${this._total}`;\n }\n }\n\n const barWidth = Math.max(0, width - stringWidth(label));\n const filled = this._value <= 0 ? 0 : Math.round(barWidth * this._value);\n const empty = barWidth - filled;\n\n // Render bar\n for (let i = 0; i < filled; i++) {\n screen.setCell(x + i, y, { char: this._fillChar, ...attrs, fg: this._fillColor });\n }\n for (let i = 0; i < empty; i++) {\n screen.setCell(x + filled + i, y, { char: this._emptyChar, ...attrs, dim: true });\n }\n\n // Render label\n if (label) {\n screen.writeString(x + barWidth, y, label, { ...attrs, bold: true });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — MultiProgress widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type Color, caps, BLOCK } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * A single progress item in MultiProgress\n */\nexport interface ProgressItem {\n label: string;\n value: number; // 0–1\n color?: Color; // optional fill color override\n}\n\n/**\n * Options for MultiProgress widget\n */\nexport interface MultiProgressOptions {\n items: ProgressItem[];\n labelWidth?: number; // chars reserved for label column, default: 12\n showValues?: boolean; // show percentage after bar, default: true\n}\n\n/**\n * MultiProgress — stacks multiple labeled progress bars in a vertical list.\n *\n * Each item renders on its own row with a label, bar, and optional percentage.\n *\n * Supports:\n * - Multiple items with individual colors\n * - Custom label column width\n * - Optional percentage display\n * - Smooth animation-ready value changes\n */\nexport class MultiProgress extends Widget {\n private _items: ProgressItem[];\n private _labelWidth: number;\n private _showValues: boolean;\n\n constructor(options: MultiProgressOptions, style: Partial<Style> = {}) {\n const height = options.items.length;\n super({ height, ...style });\n this._items = options.items.map(item => ({\n ...item,\n value: Math.max(0, Math.min(1, item.value)),\n }));\n this._labelWidth = options.labelWidth ?? 12;\n this._showValues = options.showValues ?? true;\n }\n\n /**\n * Replace all items and mark dirty\n */\n setItems(items: ProgressItem[]): void {\n this._items = items.map(item => ({\n ...item,\n value: Math.max(0, Math.min(1, item.value)),\n }));\n this.markDirty();\n }\n\n /**\n * Update a single item's value\n */\n updateItem(index: number, value: number): void {\n if (index >= 0 && index < this._items.length) {\n const normalized = Math.max(0, Math.min(1, value));\n \n if (this._items[index].value === normalized) {\n return;\n }\n \n this._items[index].value = normalized;\n this.markDirty();\n }\n }\n\n /**\n * Test-only getter for items array\n * @internal\n */\n getItemsForTest(): ProgressItem[] {\n return this._items;\n }\n\n /**\n * Test-only getter for labelWidth\n * @internal\n */\n getLabelWidthForTest(): number {\n return this._labelWidth;\n }\n\n /**\n * Test-only getter for showValues\n * @internal\n */\n getShowValuesForTest(): boolean {\n return this._showValues;\n }\n\n /**\n * Test-only getter for style height\n * @internal\n */\n getHeightForTest(): number {\n // Height is always set as number in constructor (options.items.length)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return this._style.height as number;\n }\n\n /**\n * Test-only setter for dirty state\n * @internal\n */\n setDirtyForTest(value: boolean): void {\n // _dirty is protected in Widget base class; accessible directly from subclass\n this._dirty = value;\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Determine bar characters (unicode or ASCII fallback)\n const fillChar = caps.unicode ? '█' : BLOCK.full; // '█' or '#'\n const emptyChar = caps.unicode ? '░' : BLOCK.empty; // '░' or ' '\n\n // Render each item on its own row\n for (let i = 0; i < this._items.length; i++) {\n const item = this._items[i];\n const rowY = y + i;\n let colX = x;\n\n // 1. Render label (left-aligned, truncated/padded to labelWidth)\n const label = item.label.length > this._labelWidth\n ? item.label.substring(0, this._labelWidth)\n : item.label.padEnd(this._labelWidth);\n screen.writeString(colX, rowY, label, attrs);\n colX += this._labelWidth;\n\n // 2. Space after label\n if (colX < x + width) {\n screen.setCell(colX, rowY, { char: ' ', ...attrs });\n colX++;\n }\n\n // 3. Calculate bar width (accounting for percentage label if shown)\n let percentLabel = '';\n if (this._showValues) {\n percentLabel = ` ${Math.round(item.value * 100)}%`;\n }\n const barWidth = Math.max(0, x + width - colX - percentLabel.length);\n const filled = Math.round(barWidth * item.value);\n const empty = barWidth - filled;\n\n // 4. Render filled portion\n const fillColor = item.color ?? { type: 'named', name: 'green' };\n for (let j = 0; j < filled; j++) {\n screen.setCell(colX + j, rowY, { char: fillChar, ...attrs, fg: fillColor });\n }\n\n // 5. Render empty portion\n for (let j = 0; j < empty; j++) {\n screen.setCell(colX + filled + j, rowY, { char: emptyChar, ...attrs, dim: true });\n }\n\n // 6. Render percentage label if enabled\n if (percentLabel) {\n const labelX = colX + barWidth;\n screen.writeString(labelX, rowY, percentLabel, { ...attrs, bold: true });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Spinner widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type Color, caps, BRAILLE_SPIN, prefersReducedMotion, stringWidth } from '@termuijs/core';\nimport { timerPoolSubscribe } from '@termuijs/motion';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * Built-in spinner frame sets.\n */\nexport const SPINNER_FRAMES: Record<string, { frames: string[]; asciiFrames: string[]; interval: number }> = {\n dots: {\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n asciiFrames: ['|', '/', '-', '\\\\'],\n interval: 80,\n },\n line: {\n frames: ['-', '\\\\', '|', '/'],\n asciiFrames: ['-', '\\\\', '|', '/'],\n interval: 130,\n },\n star: {\n frames: ['✶', '✸', '✹', '✺', '✹', '✷'],\n asciiFrames: ['*', 'o', '*', 'O'],\n interval: 70,\n },\n arc: {\n frames: ['◜', '◠', '◝', '◞', '◡', '◟'],\n asciiFrames: ['|', '/', '-', '\\\\'],\n interval: 100,\n },\n circle: {\n frames: ['◐', '◓', '◑', '◒'],\n asciiFrames: ['|', '/', '-', '\\\\'],\n interval: 120,\n },\n bounce: {\n frames: ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷'],\n asciiFrames: ['.', 'o', 'O', 'o'],\n interval: 120,\n },\n arrow: {\n frames: ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'],\n asciiFrames: ['<', '^', '>', 'v'],\n interval: 100,\n },\n clock: {\n frames: ['🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙', '🕚', '🕛'],\n asciiFrames: ['|', '/', '-', '\\\\'],\n interval: 100,\n },\n bar: {\n frames: ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '▇', '▆', '▅', '▄', '▃'],\n asciiFrames: ['[ ]', '[= ]', '[== ]', '[===]'],\n interval: 100,\n },\n pulse: {\n frames: ['█', '▓', '▒', '░'],\n asciiFrames: ['#', '+', '-', '.'],\n interval: 100,\n },\n};\n\nexport interface SpinnerOptions {\n /** Spinner preset name or custom frames */\n spinner?: string | { frames: string[]; interval: number };\n /** Spinner preset name (preferred option) */\n preset?: string;\n /** Text label displayed after the spinner */\n label?: string;\n /** Color for the spinner frames */\n color?: Color;\n /** Whether the spinner is active/animating (default: true) */\n active?: boolean;\n /** Text to display when active is false (e.g., '✓ Done') */\n doneText?: string;\n /** Custom frame interval in milliseconds */\n interval?: number;\n}\n\n/**\n * Spinner — animated loading indicator.\n *\n * Supports:\n * - 10 built-in spinner presets\n * - Custom frame sequences\n * - Configurable color and label\n * - Active state control and custom done state text\n * - Automatic frame advancement with system-clock smoothness\n * - ASCII fallbacks and no-motion environment support\n */\nexport class Spinner extends Widget {\n private _frames: string[];\n private _interval: number;\n private _frameIndex = 0;\n private _label: string;\n private _color: Color;\n private _elapsed = 0;\n private _timerUnsub?: () => void;\n\n private _active = true;\n private _doneText?: string;\n private _startTime?: number;\n\n constructor(style: Partial<Style> = {}, options: SpinnerOptions = {}) {\n super({ height: 1, ...style });\n\n const presetName = options.preset ?? (typeof options.spinner === 'string' ? options.spinner : undefined);\n const spinnerDef = presetName\n ? (SPINNER_FRAMES[presetName] ?? SPINNER_FRAMES.dots)\n : (typeof options.spinner === 'object' ? options.spinner : SPINNER_FRAMES.dots);\n\n // Frame interval selection with override option\n this._interval = options.interval ?? spinnerDef.interval;\n\n // Custom or preset frames\n let framesToUse = spinnerDef.frames;\n if (!caps.unicode) {\n if (presetName && SPINNER_FRAMES[presetName]?.asciiFrames) {\n framesToUse = SPINNER_FRAMES[presetName].asciiFrames;\n } else if (spinnerDef && 'asciiFrames' in spinnerDef && Array.isArray((spinnerDef as any).asciiFrames)) { // as any: asciiFrames is an optional SpinnerDef extension not in the base interface\n framesToUse = (spinnerDef as any).asciiFrames; // as any: asciiFrames is an optional SpinnerDef extension not in the base interface\n } else if (framesToUse.some(f => f.codePointAt(0)! > 127)) {\n // Generic fallback for custom unicode frames\n framesToUse = Array.from(BRAILLE_SPIN);\n this._interval = options.interval ?? 130;\n }\n }\n\n this._frames = framesToUse;\n this._label = options.label ?? '';\n this._color = options.color ?? { type: 'named', name: 'cyan' };\n this._active = options.active !== false;\n this._doneText = options.doneText;\n }\n\n /** Update the active state */\n setActive(active: boolean): void {\n if (this._active === active) return;\n this._active = active;\n this.markDirty();\n\n // Dynamically manage timer if mounted\n this._timerUnsub?.();\n this._timerUnsub = undefined;\n if (active && !prefersReducedMotion()) {\n this._startTime = Date.now();\n this._timerUnsub = timerPoolSubscribe(this._interval, () => {\n this.markDirty();\n });\n }\n }\n\n /** Update the spinner label */\n setLabel(label: string): void {\n this._label = label;\n this.markDirty();\n }\n\n /** Update doneText */\n setDoneText(doneText: string): void {\n this._doneText = doneText;\n this.markDirty();\n }\n\n /**\n * Advance the spinner frame based on elapsed time.\n * Call this with a delta (ms) from the render loop.\n */\n tick(deltaMs: number): void {\n if (prefersReducedMotion() || !this._active) return;\n\n this._elapsed += deltaMs;\n this._frameIndex = Math.floor(this._elapsed / this._interval) % this._frames.length;\n }\n\n /** Lifecycle: start the frame-advance timer (only when motion is enabled). */\n mount(): void {\n super.mount();\n if (prefersReducedMotion() || !this._active) return;\n this._startTime = Date.now();\n this._timerUnsub = timerPoolSubscribe(this._interval, () => {\n this.markDirty();\n });\n }\n\n /** Lifecycle: stop the frame-advance timer. */\n unmount(): void {\n this._timerUnsub?.();\n this._timerUnsub = undefined;\n super.unmount();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n let char = '';\n if (this._active) {\n if (prefersReducedMotion()) {\n // Static fallback when motion is disabled\n char = '[...]';\n } else {\n let idx = this._frameIndex;\n if (this._startTime !== undefined) {\n const elapsed = Date.now() - this._startTime;\n idx = Math.floor(elapsed / this._interval) % this._frames.length;\n }\n char = this._frames[idx];\n }\n } else {\n char = this._doneText ?? '';\n }\n\n // Render spinner character or doneText\n if (char) {\n screen.writeString(x, y, char, { ...attrs, fg: this._color });\n }\n\n // Render label\n if (this._label) {\n const labelX = char ? x + stringWidth(char) + 1 : x;\n screen.writeString(labelX, y, this._label, attrs);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — LoadingDots widget\n// ─────────────────────────────────────────────────────\n\nimport { type Style, type Color, type Screen, caps, styleToCellAttrs, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface LoadingDotsOptions {\n /** Label shown before the dots. */\n label?: string;\n /** Maximum number of dots in the cycle. Default: 3 */\n maxDots?: number;\n /** Dot color. Default: cyan */\n color?: Color;\n}\n\nexport class LoadingDots extends Widget {\n private _label: string;\n private _maxDots: number;\n private _color: Color;\n private _dotCount = 0;\n\n constructor(style: Partial<Style> = {}, opts: LoadingDotsOptions = {}) {\n super({ height: 1, ...style });\n this._label = opts.label ?? '';\n this._maxDots = opts.maxDots ?? 3;\n this._color = opts.color ?? { type: 'named', name: 'cyan' };\n }\n\n tick(): void {\n this._dotCount = (this._dotCount + 1) % (this._maxDots + 1);\n this.markDirty();\n }\n\n setLabel(label: string): void {\n if (label === this._label) return;\n \n this._label = label;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n let currentX = x;\n\n if (this._label) {\n screen.writeString(currentX, y, this._label, attrs);\n currentX += stringWidth(this._label);\n }\n\n\n const dotChar = caps.unicode ? '·' : '.';\n const dots = dotChar.repeat(this._dotCount);\n const padding = ' '.repeat(this._maxDots - this._dotCount);\n\n screen.writeString(currentX, y, dots + padding, { ...attrs, fg: this._color });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — TaskList widget\n// Renders a list of tasks with status indicators.\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n// ── Types ────────────────────────────────────────────\n\nexport type TaskStatus = 'pending' | 'running' | 'done' | 'error';\n\nexport interface TaskItem {\n id: string | number;\n label: string;\n status: TaskStatus;\n}\n\nexport interface TaskListOptions {\n pendingText?: string;\n runningText?: string;\n doneText?: string;\n errorText?: string;\n /** When true, the running indicator animates with a spinner. */\n wheelspin?: boolean;\n}\n\n// ── Spinner frames ────────────────────────────────────\n\n/** Braille dot spinner — used when caps.unicode is true. */\nconst SPINNER_FRAMES_UNICODE = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\n/** ASCII fallback — used when caps.unicode is false. */\nconst SPINNER_FRAMES_ASCII = ['|', '/', '-', '\\\\'];\n\nconst SPINNER_INTERVAL = 80;\n\n// ── Widget ───────────────────────────────────────────\n\n/**\n * TaskList — a vertical list of tasks with status indicators.\n *\n * Each task renders on its own row:\n * Build ⠋ ← running + wheelspin + unicode\n * Lint ... ← pending (default pendingText)\n * Tests ✓ ← done (custom doneText)\n * Deploy ✗ ← error (custom errorText)\n */\nexport class TaskList extends Widget {\n private _tasks: TaskItem[];\n private _pendingText: string;\n private _runningText: string;\n private _doneText: string;\n private _errorText: string;\n private _wheelspin: boolean;\n\n private _frameIndex = 0;\n private _elapsed = 0;\n\n constructor(\n style: Partial<Style> = {},\n options: TaskListOptions = {},\n tasks: TaskItem[] = [],\n ) {\n super(style);\n this._tasks = tasks;\n this._pendingText = options.pendingText ?? '...';\n this._runningText = options.runningText ?? '...';\n this._doneText = options.doneText ?? '...';\n this._errorText = options.errorText ?? '...';\n this._wheelspin = options.wheelspin ?? false;\n }\n\n /** Replace the task list and schedule a re-render. */\n setTasks(tasks: TaskItem[]): void {\n if (tasks === this._tasks) {\n return;\n }\n this._tasks = tasks;\n this.markDirty();\n }\n\n /**\n * Advance the spinner animation by `dt` milliseconds.\n * Only has an effect when `wheelspin` is enabled and there is at least\n * one running task. Call this from the app's render/tick loop.\n */\n tick(dt: number): void {\n if (!this._wheelspin) return;\n\n const hasRunning = this._tasks.some(t => t.status === 'running');\n if (!hasRunning) return;\n\n this._elapsed += dt;\n if (this._elapsed >= SPINNER_INTERVAL) {\n const frames = caps.unicode ? SPINNER_FRAMES_UNICODE : SPINNER_FRAMES_ASCII;\n const steps = Math.floor(this._elapsed / SPINNER_INTERVAL);\n this._frameIndex = (this._frameIndex + steps) % frames.length;\n this._elapsed %= SPINNER_INTERVAL;\n this.markDirty();\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this.rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const frames = caps.unicode ? SPINNER_FRAMES_UNICODE : SPINNER_FRAMES_ASCII;\n\n this._tasks.forEach((task, index) => {\n if (index >= height) return;\n\n let indicator: string;\n switch (task.status) {\n case 'pending': indicator = this._pendingText; break;\n case 'running': indicator = this._wheelspin\n ? (frames[this._frameIndex] ?? frames[0])\n : this._runningText;\n break;\n case 'done': indicator = this._doneText; break;\n case 'error': indicator = this._errorText; break;\n }\n\n const rowText = `${task.label} ${indicator}`;\n screen.writeString(x, y + index, rowText.substring(0, width), attrs);\n });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Scrollbar widget\n// Proportional scrollbar with 4 orientation modes.\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen, type Style, type Color,\n ScrollbarSets,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n// ── Types ────────────────────────────────────────────\n\nexport type ScrollbarOrientation =\n | 'verticalRight'\n | 'verticalLeft'\n | 'horizontalBottom'\n | 'horizontalTop';\n\nexport interface ScrollbarOptions {\n /** Total number of content items. */\n contentLength: number;\n /** Number of items visible in the viewport. */\n viewportLength: number;\n /** Current scroll position (0-based). */\n position?: number;\n /** Scrollbar orientation. Default: 'verticalRight'. */\n orientation?: ScrollbarOrientation;\n /** Color of the thumb. */\n thumbColor?: Color;\n /** Color of the track. */\n trackColor?: Color;\n /** Show begin/end arrow symbols. Default: true. */\n showArrows?: boolean;\n}\n\n// ── Widget ───────────────────────────────────────────\n\nexport class Scrollbar extends Widget {\n private _contentLength: number;\n private _viewportLength: number;\n private _position: number;\n private _orientation: ScrollbarOrientation;\n private _thumbColor: Color;\n private _trackColor: Color;\n private _showArrows: boolean;\n\n constructor(style: Partial<Style> = {}, opts: ScrollbarOptions) {\n super(style);\n this._contentLength = opts.contentLength;\n this._viewportLength = opts.viewportLength;\n this._position = opts.position ?? 0;\n this._orientation = opts.orientation ?? 'verticalRight';\n this._thumbColor = opts.thumbColor ?? { type: 'named', name: 'white' };\n this._trackColor = opts.trackColor ?? { type: 'named', name: 'brightBlack' };\n this._showArrows = opts.showArrows ?? true;\n }\n\n setPosition(position: number): void {\n if (position === this._position) {\n return;\n }\n this._position = position;\n this.markDirty();\n }\n\n setContentLength(length: number): void {\n if (length === this._contentLength) {\n return;\n }\n this._contentLength = length;\n this.markDirty();\n }\n\n setViewportLength(length: number): void {\n if (length === this._viewportLength) {\n return;\n }\n this._viewportLength = length;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._contentLength <= 0) return;\n if (this._contentLength <= this._viewportLength) return;\n\n const vertical = this._orientation === 'verticalRight'\n || this._orientation === 'verticalLeft';\n\n const symbols = vertical\n ? ScrollbarSets.VERTICAL\n : ScrollbarSets.HORIZONTAL;\n\n // Determine track position\n const trackX = this._orientation === 'verticalLeft' ? x\n : this._orientation === 'verticalRight' ? x + width - 1\n : x;\n const trackY = this._orientation === 'horizontalTop' ? y\n : this._orientation === 'horizontalBottom' ? y + height - 1\n : y;\n\n const totalLength = vertical ? height : width;\n if (totalLength <= 0) return;\n\n let trackStart = 0;\n let trackLength = totalLength;\n\n // Draw arrow symbols\n if (this._showArrows && totalLength > 2) {\n const beginX = vertical ? trackX : x;\n const beginY = vertical ? y : trackY;\n screen.setCell(beginX, beginY, {\n char: symbols.begin,\n fg: this._trackColor,\n });\n\n const endX = vertical ? trackX : x + totalLength - 1;\n const endY = vertical ? y + totalLength - 1 : trackY;\n screen.setCell(endX, endY, {\n char: symbols.end,\n fg: this._trackColor,\n });\n\n trackStart = 1;\n trackLength -= 2;\n }\n\n if (trackLength <= 0) return;\n\n // Compute thumb size and position\n const thumbSize = Math.max(1, Math.floor(\n (trackLength * this._viewportLength) / this._contentLength\n ));\n const maxScroll = Math.max(1, this._contentLength - this._viewportLength);\n const thumbOffset = Math.min(\n trackLength - thumbSize,\n Math.floor((this._position * (trackLength - thumbSize)) / maxScroll),\n );\n\n // Draw track and thumb\n for (let i = 0; i < trackLength; i++) {\n const pos = trackStart + i;\n const cellX = vertical ? trackX : x + pos;\n const cellY = vertical ? y + pos : trackY;\n\n const isThumb = i >= thumbOffset && i < thumbOffset + thumbSize;\n\n screen.setCell(cellX, cellY, {\n char: isThumb ? symbols.thumb : symbols.track,\n fg: isThumb ? this._thumbColor : this._trackColor,\n });\n }\n }\n}\n","import { type Screen, type Style, type Color, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { timerPoolSubscribe } from '@termuijs/motion';\n\nexport interface SkeletonOptions {\n variant?: 'pulse' | 'shimmer';\n intervalMs?: number;\n chars?: [string, string];\n color?: Color;\n}\n\nexport class Skeleton extends Widget {\n private _frame = 0;\n private _shimmerPos = 0;\n private _variant: 'pulse' | 'shimmer';\n private _chars: [string, string];\n private _intervalMs: number;\n private _unsubscribe?: () => void;\n\n constructor(style: Partial<Style> = {}, opts: SkeletonOptions = {}) {\n super(style);\n\n this._variant = opts.variant ?? 'pulse';\n this._intervalMs = opts.intervalMs ?? 600;\n\n this._chars = opts.chars ?? (caps.unicode ? ['░', '▒'] : ['-', '#']);\n\n if (caps.motion) {\n this._unsubscribe = timerPoolSubscribe(this._intervalMs, () => {\n this._frame = 1 - this._frame;\n this._shimmerPos++;\n this.markDirty();\n });\n }\n }\n\n override unmount(): void {\n this._unsubscribe?.();\n super.unmount();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0) return;\n\n if (this._variant === 'pulse') {\n const char = this._chars[this._frame];\n\n for (let r = 0; r < height; r++) {\n for (let c = 0; c < width; c++) {\n screen.setCell(x + c, y + r, {\n char,\n dim: this._frame === 0,\n });\n }\n }\n } else {\n const band = Math.max(1, Math.floor(width * 0.2));\n const total = width + band;\n const start = this._shimmerPos % total;\n\n for (let r = 0; r < height; r++) {\n for (let c = 0; c < width; c++) {\n const inBand = c >= start && c < start + band;\n screen.setCell(x + c, y + r, {\n char: inBand ? this._chars[1] : this._chars[0],\n dim: !inBand,\n });\n }\n }\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — StatusMessage widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type StatusVariant = 'success' | 'error' | 'warning' | 'info';\n\nexport interface StatusMessageOptions {\n /** Variant determines icon and color */\n variant?: StatusVariant;\n /** Override the icon character */\n icon?: string;\n}\n\n// Icons: unicode and ASCII fallbacks\nconst ICONS_UNICODE: Record<StatusVariant, string> = {\n success: '✓',\n error: '✗',\n warning: '⚠',\n info: 'ℹ',\n};\n\nconst ICONS_ASCII: Record<StatusVariant, string> = {\n success: '+',\n error: 'x',\n warning: '!',\n info: 'i',\n};\n\nconst COLORS: Record<StatusVariant, Color> = {\n success: { type: 'named', name: 'green' },\n error: { type: 'named', name: 'red' },\n warning: { type: 'named', name: 'yellow' },\n info: { type: 'named', name: 'cyan' },\n};\n\n/**\n * StatusMessage — a single-line status indicator.\n *\n * Renders an icon (✓/✗/⚠/ℹ) followed by a message, colored by variant.\n */\nexport class StatusMessage extends Widget {\n private _message: string;\n private _variant: StatusVariant;\n private _icon?: string;\n\n constructor(message: string, style: Partial<Style> = {}, opts: StatusMessageOptions = {}) {\n super({ height: 1, ...style });\n this._message = message;\n this._variant = opts.variant ?? 'info';\n this._icon = opts.icon;\n }\n\n setMessage(message: string): void {\n if (this._message === message) return;\n\n this._message = message;\n this.markDirty();\n }\n\n setVariant(variant: StatusVariant): void {\n if (this._variant === variant) return;\n \n this._variant = variant;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const color = COLORS[this._variant];\n const iconMap = caps.unicode ? ICONS_UNICODE : ICONS_ASCII;\n const icon = this._icon ?? iconMap[this._variant];\n\n // Render icon in variant color\n screen.writeString(x, y, icon, { ...attrs, fg: color, bold: true });\n\n // Space + message\n const msgX = x + icon.length + 1;\n const remaining = width - icon.length - 1;\n if (remaining > 0) {\n screen.writeString(msgX, y, this._message.slice(0, remaining), { ...attrs, fg: color });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Banner widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, getBorderChars, normalizeEdges, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { type StatusVariant } from './StatusMessage.js';\n\nexport interface BannerOptions {\n /** Variant determines border color */\n variant?: StatusVariant;\n /** Title displayed on first line in bold */\n title?: string;\n /** Body text */\n body?: string;\n}\n\nconst VARIANT_COLORS: Record<StatusVariant, Color> = {\n success: { type: 'named', name: 'green' },\n error: { type: 'named', name: 'red' },\n warning: { type: 'named', name: 'yellow' },\n info: { type: 'named', name: 'cyan' },\n};\n\n/**\n * Banner — full-width alert with title and body text.\n *\n * Shows a bordered box with a bold title line and body text,\n * colored according to variant. The border is drawn manually\n * to use the variant color.\n */\nexport class Banner extends Widget {\n private _variant: StatusVariant;\n private _title: string;\n private _body: string;\n\n constructor(style: Partial<Style> = {}, opts: BannerOptions = {}) {\n // Do NOT set border in style — we render it manually for color control\n super({\n width: '100%',\n padding: 1,\n ...style,\n });\n this._variant = opts.variant ?? 'info';\n this._title = opts.title ?? '';\n this._body = opts.body ?? '';\n }\n\n setTitle(title: string): void {\n if (this._title === title) return;\n\n this._title = title;\n this.markDirty();\n }\n\n setBody(body: string): void {\n if (this._body === body) return;\n\n this._body = body;\n this.markDirty();\n }\n\n setVariant(variant: StatusVariant): void {\n if (this._variant === variant) return;\n \n this._variant = variant;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width < 2 || height < 2) return;\n\n const attrs = styleToCellAttrs(this._style);\n const color = VARIANT_COLORS[this._variant];\n const fg = color;\n\n // Draw border manually in variant color\n const borderChars = getBorderChars('single');\n if (borderChars) {\n // Top edge\n screen.setCell(x, y, { char: borderChars.topLeft, fg });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y, { char: borderChars.top, fg });\n }\n screen.setCell(x + width - 1, y, { char: borderChars.topRight, fg });\n\n // Bottom edge\n screen.setCell(x, y + height - 1, { char: borderChars.bottomLeft, fg });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y + height - 1, { char: borderChars.bottom, fg });\n }\n screen.setCell(x + width - 1, y + height - 1, { char: borderChars.bottomRight, fg });\n\n // Left and right edges\n for (let r = 1; r < height - 1; r++) {\n screen.setCell(x, y + r, { char: borderChars.left, fg });\n screen.setCell(x + width - 1, y + r, { char: borderChars.right, fg });\n }\n }\n\n // Content area (inside border + padding)\n const padding = normalizeEdges(this._style.padding);\n const borderWidth = borderChars ? 1 : 0;\n const cx = x + borderWidth + padding.left;\n const cy = y + borderWidth + padding.top;\n const contentWidth = Math.max(0, width - borderWidth * 2 - padding.left - padding.right);\n const contentHeight = Math.max(0, height - borderWidth * 2 - padding.top - padding.bottom);\n\n let row = 0;\n\n // Title (bold)\n if (this._title && row < contentHeight) {\n screen.writeString(cx, cy + row, truncate(this._title, contentWidth, ''), {\n ...attrs,\n fg: color,\n bold: true,\n });\n row++;\n }\n\n // Body text\n if (this._body) {\n const lines = this._body.split('\\n');\n for (const line of lines) {\n if (row >= contentHeight) break;\n screen.writeString(cx, cy + row, truncate(line, contentWidth, ''), {\n ...attrs,\n fg: color,\n });\n row++;\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Alert widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, getBorderChars, caps, stringWidth, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { type StatusVariant } from './StatusMessage.js';\n\nexport interface AlertOptions {\n /** Variant determines icon and border color */\n variant?: StatusVariant;\n /** The message to display */\n message: string;\n}\n\nconst VARIANT_COLORS: Record<StatusVariant, Color> = {\n success: { type: 'named', name: 'green' },\n error: { type: 'named', name: 'red' },\n warning: { type: 'named', name: 'yellow' },\n info: { type: 'named', name: 'cyan' },\n};\n\nconst ICONS_UNICODE: Record<StatusVariant, string> = {\n info: '●',\n success: '✓',\n warning: '!',\n error: '✗',\n};\n\nconst ICONS_ASCII: Record<StatusVariant, string> = {\n info: 'i',\n success: '[OK]',\n warning: '[!]',\n error: '[x]',\n};\n\n/**\n * Alert — full-width status message box with a colored border and an icon prefix.\n *\n * Renders a bordered box containing an icon and a message on a single line,\n * colored according to the variant. Uses `caps.unicode` to choose between\n * Unicode box-drawing/icons and ASCII fallback borders/icons.\n */\nexport class Alert extends Widget {\n private _variant: StatusVariant;\n private _message: string;\n\n constructor(opts: AlertOptions, style: Partial<Style> = {}) {\n // Do NOT set border in style — we render it manually for color control\n super({\n width: '100%',\n padding: 1,\n ...style,\n });\n this._variant = opts.variant ?? 'info';\n this._message = opts.message ?? '';\n }\n\n /** Set the alert message */\n setMessage(message: string): void {\n if (message === this._message) {\n return;\n }\n this._message = message;\n this.markDirty();\n }\n\n /** Get the alert message */\n getMessage(): string {\n return this._message;\n }\n\n /** Set the alert variant */\n setVariant(variant: StatusVariant): void {\n if (variant === this._variant) {\n return;\n }\n this._variant = variant;\n this.markDirty();\n }\n\n /** Get the alert variant */\n getVariant(): StatusVariant {\n return this._variant;\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width < 2 || height < 2) return;\n\n const attrs = styleToCellAttrs(this._style);\n const color = VARIANT_COLORS[this._variant];\n const fg = color;\n\n // Draw border manually in variant color, respecting caps.unicode\n const borderChars = caps.unicode\n ? getBorderChars('single')\n : {\n topLeft: '+',\n top: '-',\n topRight: '+',\n right: '|',\n bottomRight: '+',\n bottom: '-',\n bottomLeft: '+',\n left: '|',\n };\n\n if (borderChars) {\n // Top edge\n screen.setCell(x, y, { char: borderChars.topLeft, fg });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y, { char: borderChars.top, fg });\n }\n screen.setCell(x + width - 1, y, { char: borderChars.topRight, fg });\n\n // Bottom edge\n screen.setCell(x, y + height - 1, { char: borderChars.bottomLeft, fg });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y + height - 1, { char: borderChars.bottom, fg });\n }\n screen.setCell(x + width - 1, y + height - 1, { char: borderChars.bottomRight, fg });\n\n // Left and right edges\n for (let r = 1; r < height - 1; r++) {\n screen.setCell(x, y + r, { char: borderChars.left, fg });\n screen.setCell(x + width - 1, y + r, { char: borderChars.right, fg });\n }\n }\n\n // Content area (inside border + padding=1)\n const cx = x + 2; // border(1) + padding(1)\n const cy = y + 2;\n const contentWidth = Math.max(0, width - 4); // left/right border+padding\n const contentHeight = Math.max(0, height - 4); // top/bottom border+padding\n\n if (contentHeight <= 0 || contentWidth <= 0) return;\n\n const iconMap = caps.unicode ? ICONS_UNICODE : ICONS_ASCII;\n const icon = iconMap[this._variant];\n\n // Render icon in variant color, bold\n const iconLen = stringWidth(icon);\n screen.writeString(cx, cy, truncate(icon, contentWidth, ''), {\n ...attrs,\n fg: color,\n bold: true,\n });\n\n // Space + message\n const msgX = cx + iconLen + 1;\n const remaining = contentWidth - iconLen - 1;\n if (remaining > 0) {\n screen.writeString(msgX, cy, truncate(this._message, remaining, ''), {\n ...attrs,\n fg: color,\n });\n }\n }\n}\n","import { type Screen, type Style, styleToCellAttrs, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface EmptyStateOptions {\n icon?: string;\n description?: string;\n hint?: string;\n}\n\nexport class EmptyState extends Widget {\n private _title: string;\n private _icon: string;\n private _description: string = '';\n private _hint: string = '';\n\n constructor(title: string, style: Partial<Style> = {}, opts: EmptyStateOptions = {}) {\n super(style);\n this._title = title;\n this._icon = opts.icon ?? (caps.unicode ? '📭' : '[]');\n if (opts.description !== undefined) this._description = opts.description;\n if (opts.hint !== undefined) this._hint = opts.hint;\n }\n\n setTitle(title: string): void {\n if (this._title === title) return;\n\n this._title = title;\n this.markDirty();\n }\n\n setDescription(description: string): void {\n if (this._description === description) return;\n\n this._description = description;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const hasHint = this._hint.length > 0;\n const hasDesc = this._description.length > 0;\n\n const hintRow = hasHint ? y + height - 1 : -1;\n const mainHeight = hasHint ? height - 1 : height;\n\n const contentLines = 1 + 1 + (hasDesc ? 1 : 0);\n const startRow = y + Math.max(0, Math.floor((mainHeight - contentLines) / 2));\n\n const iconX = x + Math.max(0, Math.floor((width - stringWidth(this._icon)) / 2));\n screen.writeString(iconX, startRow, this._icon, attrs);\n\n const titleStr = this._title;\n const titleX = x + Math.max(0, Math.floor((width - stringWidth(titleStr)) / 2));\n screen.writeString(titleX, startRow + 1, titleStr, { ...attrs, bold: true });\n\n if (hasDesc) {\n const descStr = this._description;\n const descX = x + Math.max(0, Math.floor((width - stringWidth(descStr)) / 2));\n screen.writeString(descX, startRow + 2, descStr, { ...attrs, dim: true });\n }\n\n if (hasHint) {\n const hintStr = this._hint;\n const hintX = x + Math.max(0, Math.floor((width - stringWidth(hintStr)) / 2));\n screen.writeString(hintX, hintRow, hintStr, { ...attrs, dim: true });\n }\n }\n}\n","import { type Screen, type Style, type Color, styleToCellAttrs, caps, stringWidth, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type CalloutVariant = 'info' | 'warn' | 'success' | 'danger';\n\nexport interface CalloutOptions {\n variant?: CalloutVariant;\n title?: string;\n}\n\nconst ICONS_UNICODE: Record<CalloutVariant, string> = {\n info: 'ℹ',\n warn: '⚠',\n success: '✓',\n danger: '✗',\n};\n\nconst ICONS_ASCII: Record<CalloutVariant, string> = {\n info: 'i',\n warn: '!',\n success: 'v',\n danger: 'x',\n};\n\nconst COLORS: Record<CalloutVariant, Color> = {\n info: { type: 'named', name: 'blue' },\n warn: { type: 'named', name: 'yellow' },\n success: { type: 'named', name: 'green' },\n danger: { type: 'named', name: 'red' },\n};\n\nexport class Callout extends Widget {\n private _message: string;\n private _variant: CalloutVariant;\n private _title: string;\n\n constructor(message: string, style: Partial<Style> = {}, opts: CalloutOptions = {}) {\n super({ height: 1, ...style });\n this._message = message;\n this._variant = opts.variant ?? 'info';\n this._title = opts.title ?? '';\n }\n\n setMessage(message: string): void {\n if (message === this._message) return;\n\n this._message = message;\n this.markDirty();\n }\n\n setVariant(variant: CalloutVariant): void {\n if (variant === this._variant) return;\n \n this._variant = variant;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const color = COLORS[this._variant];\n const iconMap = caps.unicode ? ICONS_UNICODE : ICONS_ASCII;\n const icon = iconMap[this._variant];\n\n let cursor = x;\n\n screen.writeString(cursor, y, icon, { ...attrs, fg: color, bold: true });\n cursor += stringWidth(icon);\n\n if (this._title) {\n const titleStr = ' ' + this._title;\n const avail = width - cursor;\n if (avail > 0) {\n const truncated = truncate(titleStr, avail);\n screen.writeString(cursor, y, truncated, { ...attrs, fg: color, bold: true });\n cursor += stringWidth(truncated);\n }\n }\n\n const msgPrefix = this._title || this._message ? ' ' : '';\n const msgStr = msgPrefix + this._message;\n const avail = width - cursor;\n if (avail > 0) {\n screen.writeString(cursor, y, msgStr.slice(0, avail), { ...attrs, fg: color });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — KeyValue widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface KeyValuePair {\n key: string;\n // any is used because the value can be of completely arbitrary nested object structures or primitive types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any;\n}\n\nexport interface KeyValueOptions {\n /** Separator between key and value (default: ': ') */\n separator?: string;\n /** Color for keys */\n keyColor?: import('@termuijs/core').Color;\n /** Color for values */\n valueColor?: import('@termuijs/core').Color;\n}\n\n/**\n * KeyValue — aligned key: value pairs.\n *\n * Keys are right-aligned to the width of the longest key.\n * Values follow after the separator.\n */\nexport class KeyValue extends Widget {\n private _pairs: KeyValuePair[];\n private _separator: string;\n private _keyColor?: import('@termuijs/core').Color;\n private _valueColor?: import('@termuijs/core').Color;\n\n private _expandedPaths = new Set<string>();\n private _selectedIndex = 0;\n\n constructor(\n // any is used because pairs can be objects with unknown/arbitrary arbitrary depth properties\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pairs: Array<KeyValuePair> | Record<string, any>,\n style: Partial<Style> = {},\n opts: KeyValueOptions = {},\n ) {\n super(style);\n this._pairs = Array.isArray(pairs)\n ? pairs\n : Object.entries(pairs).map(([key, value]) => ({ key, value }));\n this._separator = opts.separator ?? ': ';\n this._keyColor = opts.keyColor;\n this._valueColor = opts.valueColor;\n\n this._updateFocusable();\n }\n\n // any is used because pairs can be objects with unknown/arbitrary arbitrary depth properties\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setPairs(pairs: Array<KeyValuePair> | Record<string, any>): void {\n this._pairs = Array.isArray(pairs)\n ? pairs\n : Object.entries(pairs).map(([key, value]) => ({ key, value }));\n this._updateFocusable();\n this.markDirty();\n }\n\n private _updateFocusable() {\n this.focusable = this._pairs.some(p => typeof p.value === 'object' && p.value !== null && !Array.isArray(p.value));\n }\n\n private _getVisibleRows() {\n const rows: { id: string; displayKey: string; valStr: string; isObj: boolean }[] = [];\n \n const traverse = (items: KeyValuePair[], depth: number, basePath: string) => {\n for (const item of items) {\n const isObj = typeof item.value === 'object' && item.value !== null && !Array.isArray(item.value);\n const id = basePath ? `${basePath}.${item.key}` : item.key;\n \n let prefix = '';\n if (isObj) {\n prefix = this._expandedPaths.has(id) ? (caps.unicode ? '▼ ' : 'v ') : (caps.unicode ? '▶ ' : '> ');\n }\n \n const indent = ' '.repeat(depth);\n const displayKey = indent + prefix + item.key;\n \n let valStr = String(item.value);\n if (isObj) {\n valStr = `[${Object.keys(item.value).length} keys]`;\n }\n \n rows.push({ id, displayKey, valStr, isObj });\n \n if (isObj && this._expandedPaths.has(id)) {\n const children = Object.entries(item.value).map(([k, v]) => ({ key: k, value: v }));\n traverse(children, depth + 1, id);\n }\n }\n };\n \n traverse(this._pairs, 0, '');\n return rows;\n }\n\n moveUp(): void {\n this._selectedIndex = Math.max(0, this._selectedIndex - 1);\n this.markDirty();\n }\n\n moveDown(): void {\n const rows = this._getVisibleRows();\n this._selectedIndex = Math.min(rows.length - 1, this._selectedIndex + 1);\n this.markDirty();\n }\n\n toggleSelected(): void {\n const rows = this._getVisibleRows();\n const row = rows[this._selectedIndex];\n if (row && row.isObj) {\n if (this._expandedPaths.has(row.id)) {\n this._expandedPaths.delete(row.id);\n } else {\n this._expandedPaths.add(row.id);\n }\n this.markDirty();\n }\n }\n\n handleKey(key: string): void {\n const lowerKey = key.toLowerCase();\n if (lowerKey === 'up' || lowerKey === 'k') {\n this.moveUp();\n } else if (lowerKey === 'down' || lowerKey === 'j') {\n this.moveDown();\n } else if (lowerKey === 'enter' || lowerKey === ' ' || lowerKey === 'space') {\n this.toggleSelected();\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._pairs.length === 0) return;\n\n const rows = this._getVisibleRows();\n if (rows.length === 0) return;\n\n // Keep selection in bounds\n if (this._selectedIndex >= rows.length) {\n this._selectedIndex = Math.max(0, rows.length - 1);\n }\n\n const attrs = styleToCellAttrs(this._style);\n\n // Find max key width for alignment\n let maxKeyWidth = 0;\n for (const row of rows) {\n const w = stringWidth(row.displayKey);\n if (w > maxKeyWidth) maxKeyWidth = w;\n }\n\n const sepWidth = stringWidth(this._separator);\n\n // Calculate scroll offset to keep selected row in view\n let startIdx = 0;\n if (this._selectedIndex >= height) {\n startIdx = this._selectedIndex - height + 1;\n }\n\n for (let i = 0; i < height; i++) {\n const rowIdx = startIdx + i;\n const row = rows[rowIdx];\n if (!row) continue;\n\n const isSelected = this.isFocused && rowIdx === this._selectedIndex;\n\n const keyWidth = stringWidth(row.displayKey);\n const keyX = x + (maxKeyWidth - keyWidth); // right-align key\n const sepX = x + maxKeyWidth;\n const valX = sepX + sepWidth;\n const valWidth = Math.max(0, width - maxKeyWidth - sepWidth);\n\n // Highlight using dim/bold styles to keep minimalism without causing weird blockiness\n const displayFg = isSelected ? { type: 'named' as const, name: 'cyan' as const } : undefined;\n\n // Key\n screen.writeString(keyX, y + i, row.displayKey, {\n ...attrs,\n fg: displayFg ?? this._keyColor ?? attrs.fg,\n bold: isSelected || true,\n });\n\n // Separator\n screen.writeString(sepX, y + i, this._separator, { \n ...attrs, \n dim: true,\n fg: displayFg ?? attrs.fg\n });\n\n // Value\n if (valWidth > 0) {\n screen.writeString(valX, y + i, row.valStr.slice(0, valWidth), {\n ...attrs,\n fg: displayFg ?? this._valueColor ?? attrs.fg,\n dim: row.isObj && !isSelected\n });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Sidebar widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface SidebarItem {\n label: string;\n badge?: string;\n active?: boolean;\n}\n\nexport interface SidebarOptions {\n /** Whether the sidebar is collapsed */\n collapsed?: boolean;\n /** Collapsed width in cells (default: 3) */\n collapsedWidth?: number;\n /** Active item highlight color */\n activeColor?: import('@termuijs/core').Color;\n /** Badge color */\n badgeColor?: import('@termuijs/core').Color;\n}\n\n/**\n * Sidebar — a vertical list of navigation items with optional badges.\n *\n * Supports active item highlighting and collapsible mode.\n */\nexport class Sidebar extends Widget {\n private _items: SidebarItem[];\n private _collapsed: boolean;\n private _collapsedWidth: number;\n private _activeColor: import('@termuijs/core').Color;\n private _badgeColor: import('@termuijs/core').Color;\n\n constructor(items: SidebarItem[], style: Partial<Style> = {}, opts: SidebarOptions = {}) {\n super(style);\n this._items = items;\n this._collapsed = opts.collapsed ?? false;\n this._collapsedWidth = opts.collapsedWidth ?? 3;\n this._activeColor = opts.activeColor ?? { type: 'named', name: 'cyan' };\n this._badgeColor = opts.badgeColor ?? { type: 'named', name: 'yellow' };\n }\n\n setItems(items: SidebarItem[]): void {\n this._items = items;\n this.markDirty();\n }\n\n setCollapsed(collapsed: boolean): void {\n this._collapsed = collapsed;\n this.markDirty();\n }\n\n toggle(): void {\n this._collapsed = !this._collapsed;\n this.markDirty();\n }\n\n get isCollapsed(): boolean { return this._collapsed; }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n for (let i = 0; i < this._items.length && i < height; i++) {\n const item = this._items[i];\n if (!item) continue;\n\n const isActive = item.active ?? false;\n const fg = isActive ? this._activeColor : attrs.fg;\n\n if (this._collapsed) {\n // Collapsed: show first character of label only\n const char = item.label.charAt(0) || ' ';\n screen.writeString(x, y + i, char, { ...attrs, fg, bold: isActive });\n } else {\n // Active indicator\n const prefix = isActive ? '▶ ' : ' ';\n const prefixWidth = stringWidth(prefix);\n\n screen.writeString(x, y + i, prefix, { ...attrs, fg });\n\n // Label\n const badgeText = item.badge ? ` [${item.badge}]` : '';\n const badgeWidth = stringWidth(badgeText);\n const labelWidth = Math.max(0, width - prefixWidth - badgeWidth);\n const label = item.label.slice(0, labelWidth);\n\n screen.writeString(x + prefixWidth, y + i, label, {\n ...attrs,\n fg,\n bold: isActive,\n });\n\n // Badge\n if (item.badge && badgeWidth > 0) {\n const badgeX = x + width - badgeWidth;\n screen.writeString(badgeX, y + i, badgeText, {\n ...attrs,\n fg: this._badgeColor,\n });\n }\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — LineChart widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface LineChartOptions {\n /** Color of the plotted points/lines */\n color?: Color;\n /** Show Y-axis labels */\n showYAxis?: boolean;\n /** Show X-axis labels */\n showXAxis?: boolean;\n /** Label for the Y axis */\n yLabel?: string;\n /** Maximum Y value (auto if not set) */\n max?: number;\n /** Minimum Y value (auto if not set) */\n min?: number;\n}\n\n// Unicode point character; ASCII fallback\nconst POINT_CHAR_UNICODE = '●';\nconst POINT_CHAR_ASCII = '*';\n\n/**\n * LineChart — ASCII/Unicode line plot for a series of numbers.\n *\n * Normalizes data to the available height, samples to fit width.\n * Plots points with simple vertical bar connectors between adjacent points.\n */\nexport class LineChart extends Widget {\n private _data: number[];\n private _color: Color;\n private _showYAxis: boolean;\n private _showXAxis: boolean;\n private _yLabel: string;\n private _max?: number;\n private _min?: number;\n\n constructor(data: number[], style: Partial<Style> = {}, opts: LineChartOptions = {}) {\n super(style);\n this._data = data;\n this._color = opts.color ?? { type: 'named', name: 'cyan' };\n this._showYAxis = opts.showYAxis ?? false;\n this._showXAxis = opts.showXAxis ?? false;\n this._yLabel = opts.yLabel ?? '';\n this._max = opts.max;\n this._min = opts.min;\n }\n\n setData(data: number[]): void {\n this._data = data;\n this.markDirty();\n }\n\n pushValue(value: number): void {\n this._data.push(value);\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n let { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._data.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Reserve rows for X axis\n const plotHeight = this._showXAxis ? Math.max(1, height - 1) : height;\n // Reserve cols for Y axis\n const yAxisWidth = this._showYAxis ? 5 : 0;\n const plotWidth = Math.max(1, width - yAxisWidth);\n const plotX = x + yAxisWidth;\n\n // Compute range\n const min = this._min ?? Math.min(...this._data);\n const max = this._max ?? Math.max(...this._data);\n const range = max - min || 1;\n\n // Sample data to fit plotWidth\n const samples: number[] = [];\n for (let col = 0; col < plotWidth; col++) {\n const idx = Math.floor((col / plotWidth) * this._data.length);\n const val = this._data[Math.min(idx, this._data.length - 1)];\n samples.push(val ?? min);\n }\n\n // Map value to row (row 0 = top = max)\n const toRow = (v: number): number => {\n const norm = (v - min) / range;\n return Math.max(0, Math.min(plotHeight - 1, Math.round((1 - norm) * (plotHeight - 1))));\n };\n\n // Render Y axis\n if (this._showYAxis && yAxisWidth > 0) {\n for (let row = 0; row < plotHeight; row++) {\n const v = plotHeight > 1 ? max - (row / (plotHeight - 1)) * range : max;\n if (row === 0 || row === plotHeight - 1) {\n const label = v.toFixed(0).padStart(yAxisWidth - 1, ' ');\n screen.writeString(x, y + row, label + '┤', { ...attrs, dim: true });\n } else {\n screen.writeString(x + yAxisWidth - 1, y + row, '│', { ...attrs, dim: true });\n }\n }\n }\n\n // Render points and connectors\n const pointChar = caps.unicode ? POINT_CHAR_UNICODE : POINT_CHAR_ASCII;\n\n let prevRow: number | null = null;\n for (let col = 0; col < samples.length; col++) {\n const val = samples[col];\n if (val === undefined) continue;\n const row = toRow(val);\n\n // Draw vertical connector from prev point to current\n if (prevRow !== null && Math.abs(row - prevRow) > 1) {\n const top = Math.min(prevRow, row) + 1;\n const bottom = Math.max(prevRow, row);\n for (let r = top; r < bottom; r++) {\n screen.setCell(plotX + col, y + r, { char: '│', fg: this._color, dim: true });\n }\n }\n\n // Draw point\n screen.setCell(plotX + col, y + row, { char: pointChar, fg: this._color });\n\n prevRow = row;\n }\n\n // X axis\n if (this._showXAxis) {\n const axisY = y + height - 1;\n for (let col = 0; col < plotWidth; col++) {\n screen.setCell(plotX + col, axisY, { char: '─', ...attrs, dim: true });\n }\n if (yAxisWidth > 0) {\n screen.setCell(plotX - 1, axisY, { char: '└', ...attrs, dim: true });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — AreaChart widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps, stringWidth, BRAILLE_DOTS, BRAILLE_OFFSET } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface AreaChartOptions {\n xLabel?: string;\n yLabel?: string;\n lineColor?: Color;\n fillColor?: Color;\n showLine?: boolean;\n}\n\ntype CanvasLayer = 'fill' | 'line';\n\ninterface BrailleCell {\n fillBits: number;\n lineBits: number;\n}\n\nclass BrailleCanvas {\n private _cellWidth: number;\n private _cellHeight: number;\n private _cells: BrailleCell[];\n\n constructor(width: number, height: number) {\n this._cellWidth = Math.max(1, Math.ceil(width / 2));\n this._cellHeight = Math.max(1, Math.ceil(height / 4));\n this._cells = Array.from({ length: this._cellWidth * this._cellHeight }, () => ({\n fillBits: 0,\n lineBits: 0,\n }));\n }\n\n drawPixel(x: number, y: number, layer: CanvasLayer = 'fill'): void {\n if (x < 0 || y < 0) return;\n\n const cellX = Math.floor(x / 2);\n const cellY = Math.floor(y / 4);\n if (cellX < 0 || cellY < 0 || cellX >= this._cellWidth || cellY >= this._cellHeight) return;\n\n const dotRow = y % 4;\n const dotCol = x % 2;\n const dotBits = BRAILLE_DOTS[dotRow];\n if (!dotBits) return;\n\n const bit = dotCol === 0 ? dotBits[0] : dotBits[1];\n const cell = this._cells[cellY * this._cellWidth + cellX];\n if (!cell) return;\n\n if (layer === 'line') {\n cell.lineBits |= bit;\n } else {\n cell.fillBits |= bit;\n }\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, layer: CanvasLayer = 'line'): void {\n let cx = x0;\n let cy = y0;\n const dx = Math.abs(x1 - x0);\n const dy = Math.abs(y1 - y0);\n const sx = x0 < x1 ? 1 : -1;\n const sy = y0 < y1 ? 1 : -1;\n let err = dx - dy;\n\n while (true) {\n this.drawPixel(cx, cy, layer);\n if (cx === x1 && cy === y1) break;\n\n const e2 = err * 2;\n if (e2 > -dy) {\n err -= dy;\n cx += sx;\n }\n if (e2 < dx) {\n err += dx;\n cy += sy;\n }\n }\n }\n\n render(\n screen: Screen,\n x: number,\n y: number,\n fillColor: Color,\n lineColor: Color,\n attrs: ReturnType<typeof styleToCellAttrs>,\n asciiFallback: boolean,\n ): void {\n for (let cy = 0; cy < this._cellHeight; cy++) {\n for (let cx = 0; cx < this._cellWidth; cx++) {\n const cell = this._cells[cy * this._cellWidth + cx];\n if (!cell) continue;\n\n const unionBits = cell.fillBits | cell.lineBits;\n if (unionBits === 0) continue;\n\n const char = asciiFallback\n ? '#'\n : String.fromCharCode(BRAILLE_OFFSET + unionBits);\n\n const fg = cell.lineBits !== 0 ? lineColor : fillColor;\n screen.setCell(x + cx, y + cy, { char, ...attrs, fg });\n }\n }\n }\n}\n\nexport class AreaChart extends Widget {\n private _data: number[] = [];\n private _xLabel: string;\n private _yLabel: string;\n private _lineColor: Color;\n private _fillColor: Color;\n private _showLine: boolean;\n\n constructor(style: Partial<Style> = {}, opts: AreaChartOptions = {}) {\n super(style);\n this._xLabel = opts.xLabel ?? '';\n this._yLabel = opts.yLabel ?? '';\n this._lineColor = opts.lineColor ?? { type: 'named', name: 'cyan' };\n this._fillColor = opts.fillColor ?? { type: 'named', name: 'brightBlack' };\n this._showLine = opts.showLine ?? true;\n }\n\n setData(values: number[]): void {\n this._data = values;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const topLabelRows = this._yLabel ? 1 : 0;\n const bottomLabelRows = this._xLabel ? 1 : 0;\n const plotY = y + topLabelRows;\n const plotHeight = height - topLabelRows - bottomLabelRows;\n\n if (this._yLabel) {\n screen.writeString(x, y, this._yLabel.slice(0, width), attrs);\n }\n\n if (this._xLabel) {\n const labelWidth = stringWidth(this._xLabel);\n const labelX = x + Math.max(0, width - labelWidth);\n screen.writeString(labelX, y + height - 1, this._xLabel.slice(0, width), attrs);\n }\n\n if (plotHeight <= 0 || this._data.length === 0) return;\n\n const min = Math.min(...this._data);\n const max = Math.max(...this._data);\n const range = max - min || 1;\n\n const pixelWidth = width * 2;\n const pixelHeight = plotHeight * 4;\n const fillCanvas = new BrailleCanvas(pixelWidth, pixelHeight);\n const lineCanvas = new BrailleCanvas(pixelWidth, pixelHeight);\n\n const sampleValueAt = (pixelX: number): number => {\n if (this._data.length === 1) return this._data[0] ?? min;\n\n const position = (pixelX / Math.max(1, pixelWidth - 1)) * (this._data.length - 1);\n const leftIndex = Math.floor(position);\n const rightIndex = Math.min(this._data.length - 1, leftIndex + 1);\n const t = position - leftIndex;\n const left = this._data[leftIndex] ?? min;\n const right = this._data[rightIndex] ?? left;\n return left + (right - left) * t;\n };\n\n let previousX: number | null = null;\n let previousY: number | null = null;\n\n for (let pixelX = 0; pixelX < pixelWidth; pixelX++) {\n const value = sampleValueAt(pixelX);\n const normalized = (value - min) / range;\n const lineY = Math.max(0, Math.min(pixelHeight - 1, Math.round((1 - normalized) * (pixelHeight - 1))));\n\n for (let pixelY = lineY; pixelY < pixelHeight; pixelY++) {\n fillCanvas.drawPixel(pixelX, pixelY, 'fill');\n }\n\n if (this._showLine) {\n if (previousX !== null && previousY !== null) {\n lineCanvas.drawLine(previousX, previousY, pixelX, lineY, 'line');\n } else {\n lineCanvas.drawPixel(pixelX, lineY, 'line');\n }\n }\n\n previousX = pixelX;\n previousY = lineY;\n }\n\n fillCanvas.render(screen, x, plotY, this._fillColor, this._lineColor, attrs, !caps.unicode);\n if (this._showLine) {\n lineCanvas.render(screen, x, plotY, this._fillColor, this._lineColor, attrs, !caps.unicode);\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — HeatMap widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface HeatMapOptions {\n /** Color for maximum value cells */\n highColor?: Color;\n /** Color for minimum value cells */\n lowColor?: Color;\n /** Row labels (left side) */\n rowLabels?: string[];\n /** Column labels (top) */\n colLabels?: string[];\n}\n\n// Shading characters from sparse to dense\nconst SHADE_CHARS_UNICODE = ['░', '▒', '▓', '█'];\nconst SHADE_CHARS_ASCII = ['.', ':', '+', '#'];\n\n/**\n * HeatMap — 2D matrix displayed with character-density shading.\n *\n * Values are normalized 0–1 and mapped to 4 shading levels.\n */\nexport class HeatMap extends Widget {\n private _matrix: number[][];\n private _highColor: Color;\n private _lowColor: Color;\n private _rowLabels: string[];\n private _colLabels: string[];\n\n constructor(matrix: number[][], style: Partial<Style> = {}, opts: HeatMapOptions = {}) {\n super(style);\n this._matrix = matrix;\n this._highColor = opts.highColor ?? { type: 'named', name: 'red' };\n this._lowColor = opts.lowColor ?? { type: 'named', name: 'brightBlack' };\n this._rowLabels = opts.rowLabels ?? [];\n this._colLabels = opts.colLabels ?? [];\n }\n\n setMatrix(matrix: number[][]): void {\n this._matrix = matrix;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._matrix.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const shadeChars = caps.unicode ? SHADE_CHARS_UNICODE : SHADE_CHARS_ASCII;\n\n // Compute row label width\n const labelWidth = this._rowLabels.length > 0\n ? Math.max(...this._rowLabels.map(l => l.length)) + 1\n : 0;\n\n // Compute global min/max for normalization\n let globalMin = Infinity;\n let globalMax = -Infinity;\n for (const row of this._matrix) {\n for (const val of row) {\n if (val < globalMin) globalMin = val;\n if (val > globalMax) globalMax = val;\n }\n }\n const range = globalMax - globalMin || 1;\n\n // Column labels\n let startRow = 0;\n if (this._colLabels.length > 0) {\n for (let col = 0; col < this._colLabels.length; col++) {\n const cx = x + labelWidth + col;\n if (cx >= x + width) break;\n const label = (this._colLabels[col] ?? '').charAt(0);\n screen.setCell(cx, y, { char: label, ...attrs, dim: true });\n }\n startRow = 1;\n }\n\n // Render matrix rows\n for (let r = 0; r < this._matrix.length; r++) {\n const rowY = y + startRow + r;\n if (rowY >= y + height) break;\n\n // Row label\n if (this._rowLabels[r]) {\n const label = this._rowLabels[r].slice(0, labelWidth - 1).padEnd(labelWidth - 1, ' ');\n screen.writeString(x, rowY, label + ' ', { ...attrs, dim: true });\n }\n\n const row = this._matrix[r];\n if (!row) continue;\n\n for (let col = 0; col < row.length; col++) {\n const cx = x + labelWidth + col;\n if (cx >= x + width) break;\n\n const val = row[col] ?? 0;\n const norm = (val - globalMin) / range; // 0..1\n const level = Math.min(3, Math.floor(norm * 4));\n const char = shadeChars[level] ?? shadeChars[0]!;\n\n // Blend color: low → high based on norm\n // Use high color for dense cells\n const fg = norm >= 0.75 ? this._highColor : this._lowColor;\n\n screen.setCell(cx, rowY, { char, fg });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Definition widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface DefinitionPair {\n term: string;\n definition: string;\n}\n\nexport interface DefinitionOptions {\n /** Indentation for definition lines (default: 2) */\n indent?: number;\n /** Blank line between pairs (default: true) */\n spacing?: boolean;\n /** Color for term labels */\n termColor?: import('@termuijs/core').Color;\n /** Color for definition text */\n definitionColor?: import('@termuijs/core').Color;\n}\n\n/**\n * Definition — term + definition pairs, stacked vertically.\n *\n * Each pair renders as:\n * Term\n * definition text (indented)\n *\n * Similar to KeyValue but stacked rather than inline.\n */\nexport class Definition extends Widget {\n private _pairs: DefinitionPair[];\n private _indent: number;\n private _spacing: boolean;\n private _termColor?: import('@termuijs/core').Color;\n private _definitionColor?: import('@termuijs/core').Color;\n\n constructor(\n pairs: DefinitionPair[] | Record<string, string>,\n style: Partial<Style> = {},\n opts: DefinitionOptions = {},\n ) {\n super(style);\n this._pairs = Array.isArray(pairs)\n ? pairs\n : Object.entries(pairs).map(([term, definition]) => ({ term, definition }));\n this._indent = opts.indent ?? 2;\n this._spacing = opts.spacing ?? true;\n this._termColor = opts.termColor;\n this._definitionColor = opts.definitionColor;\n }\n\n setPairs(pairs: DefinitionPair[] | Record<string, string>): void {\n this._pairs = Array.isArray(pairs)\n ? pairs\n : Object.entries(pairs).map(([term, definition]) => ({ term, definition }));\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._pairs.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const indent = Math.min(this._indent, width - 1);\n\n let row = 0;\n\n for (const pair of this._pairs) {\n if (row >= height) break;\n\n // Term (bold)\n screen.writeString(x, y + row, truncate(pair.term, width, ''), {\n ...attrs,\n fg: this._termColor ?? attrs.fg,\n bold: true,\n });\n row++;\n\n if (row >= height) break;\n\n // Definition (indented, may span multiple lines via simple wrapping)\n const defWidth = Math.max(1, width - indent);\n const words = pair.definition.split(' ');\n let line = '';\n let lineWidth = 0;\n\n for (const word of words) {\n const wordWidth = stringWidth(word);\n if (lineWidth === 0) {\n line = word;\n lineWidth = wordWidth;\n } else if (lineWidth + 1 + wordWidth <= defWidth) {\n line += ' ' + word;\n lineWidth += 1 + wordWidth;\n } else {\n if (row >= height) break;\n screen.writeString(x + indent, y + row, line, {\n ...attrs,\n fg: this._definitionColor ?? attrs.fg,\n });\n row++;\n line = word;\n lineWidth = wordWidth;\n }\n }\n\n if (line && row < height) {\n screen.writeString(x + indent, y + row, line, {\n ...attrs,\n fg: this._definitionColor ?? attrs.fg,\n });\n row++;\n }\n\n // Blank line between pairs\n if (this._spacing && row < height) {\n row++;\n }\n }\n }\n}\n","import { Widget } from '../base/Widget.js'\nimport { type Screen, type Style, styleToCellAttrs } from '@termuijs/core'\n\nexport interface HexdumpOptions {\n /** Bytes per row. Default: 16 */\n bytesPerRow?: number\n\n /** Character shown for non-printable bytes in ASCII column. Default: '.' */\n placeholder?: string\n}\n\nexport class Hexdump extends Widget {\n private data!: Uint8Array\n private opts!: HexdumpOptions\n\n constructor(\n data: Uint8Array,\n style?: Partial<Style>,\n opts?: HexdumpOptions,\n ) {\n super(style)\n\n this.data = data\n this.opts = {\n bytesPerRow: 16,\n placeholder: '.',\n ...opts,\n }\n }\n\n setData(data: Uint8Array): void {\n this.data = data\n this.markDirty()\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect()\n const { x, y, width, height } = rect\n if (width <= 0 || height <= 0) return\n\n const attrs = styleToCellAttrs(this._style)\n const bytesPerRow = this.opts.bytesPerRow!\n const placeholder = this.opts.placeholder!\n\n const numRows = Math.ceil(this.data.length / bytesPerRow)\n const renderRows = Math.min(height, numRows)\n\n const half = Math.floor(bytesPerRow / 2)\n\n for (let row = 0; row < renderRows; row++) {\n const offset = row * bytesPerRow\n const chunk = this.data.subarray(offset, offset + bytesPerRow)\n\n // 1. Offset string (8 chars)\n const offsetStr = offset.toString(16).padStart(8, '0')\n\n // 2. Hex strings (e.g. \"41 42 43 \")\n let hexStr = ''\n for (let i = 0; i < bytesPerRow; i++) {\n if (i < chunk.length) {\n hexStr += chunk[i].toString(16).padStart(2, '0') + ' '\n } else {\n hexStr += ' '\n }\n \n // Add extra space halfway\n if (i === half - 1 && bytesPerRow > 1) {\n hexStr += ' '\n }\n }\n\n // 3. ASCII column\n let asciiStr = '|'\n for (let i = 0; i < chunk.length; i++) {\n const byte = chunk[i]\n // Printable ASCII: 32 to 126\n if (byte >= 32 && byte <= 126) {\n asciiStr += String.fromCharCode(byte)\n } else {\n asciiStr += placeholder\n }\n }\n for (let i = chunk.length; i < bytesPerRow; i++) {\n asciiStr += ' '\n }\n asciiStr += '|'\n\n const line = `${offsetStr} ${hexStr} ${asciiStr}`\n \n // Render line, truncate to width if necessary\n screen.writeString(x, y + row, line.substring(0, width), attrs)\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — BulletChart widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface BulletRange {\n to: number;\n color?: Color;\n}\n\nexport interface BulletChartOptions {\n max?: number;\n ranges?: BulletRange[];\n valueColor?: Color;\n targetColor?: Color;\n label?: string;\n}\n\n/**\n * BulletChart — a metric display with target marker and qualitative range bands.\n */\nexport class BulletChart extends Widget {\n private _value: number = 0;\n private _target: number = 0;\n private _max: number;\n private _ranges: BulletRange[];\n private _valueColor: Color;\n private _targetColor: Color;\n private _label: string;\n\n constructor(style: Partial<Style> = {}, opts: BulletChartOptions = {}) {\n super(style);\n this._max = opts.max !== undefined && opts.max > 0 ? opts.max : 100;\n this._ranges = [...(opts.ranges ?? [])].sort((a, b) => a.to - b.to);\n this._valueColor = opts.valueColor ?? { type: 'named', name: 'cyan' };\n this._targetColor = opts.targetColor ?? { type: 'named', name: 'white' };\n this._label = opts.label ?? '';\n }\n\n setValue(value: number): void {\n this._value = Math.max(0, Math.min(this._max, value));\n this.markDirty();\n }\n\n setTarget(target: number): void {\n this._target = Math.max(0, Math.min(this._max, target));\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n const labelStr = this._label ? this._label + ' ' : '';\n const labelWidth = stringWidth(labelStr);\n const barWidth = Math.max(0, width - labelWidth);\n\n if (this._label) {\n screen.writeString(x, y, labelStr, { ...attrs, bold: true });\n }\n\n if (barWidth <= 0) return;\n\n const valueCells = Math.max(0, Math.min(barWidth, Math.round((this._value / this._max) * barWidth)));\n const targetCell = Math.max(0, Math.min(barWidth - 1, Math.round((this._target / this._max) * barWidth)));\n\n const barX = x + labelWidth;\n\n for (let i = 0; i < barWidth; i++) {\n const cellValue = (i / barWidth) * this._max;\n let rangeColor: Color | undefined = undefined;\n for (const range of this._ranges) {\n if (cellValue <= range.to) {\n rangeColor = range.color;\n break;\n }\n }\n\n let char = ' ';\n let fg = attrs.fg;\n let bg = rangeColor ?? attrs.bg;\n\n if (caps.unicode) {\n if (i === targetCell) {\n char = '│';\n fg = this._targetColor;\n } else if (i < valueCells) {\n char = '▄';\n fg = this._valueColor;\n } else {\n char = ' ';\n }\n } else {\n // ASCII Fallback\n if (i === targetCell) {\n char = '|';\n fg = this._targetColor;\n } else if (i < valueCells) {\n char = '=';\n fg = this._valueColor;\n } else {\n char = '-';\n if (!rangeColor) {\n fg = { type: 'named', name: 'brightBlack' };\n }\n }\n }\n\n screen.setCell(barX + i, y, { char, fg, bg });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Breadcrumbs widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, stringWidth, caps, styleToCellAttrs, truncate } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface BreadcrumbsOptions {\n /** Separator drawn between segments. Default: caps.unicode ? '❯' : '>' */\n separator?: string;\n /** Color of the last (current) segment. Default: cyan */\n activeColor?: Color;\n}\n\n/**\n * Breadcrumbs — renders a non-interactive path trail of segments with separators and truncation.\n *\n * Example output:\n * Home ❯ Docs ❯ API\n */\nexport class Breadcrumbs extends Widget {\n private _segments: string[];\n private _separator?: string;\n private _activeColor?: Color;\n\n constructor(segments: string[], style: Partial<Style> = {}, opts: BreadcrumbsOptions = {}) {\n super(style);\n this._segments = segments;\n this._separator = opts.separator;\n this._activeColor = opts.activeColor;\n }\n\n /** Update the trail of segments. */\n setSegments(segments: string[]): void {\n if (\n this._segments.length === segments.length &&\n this._segments.every((segment, index) => segment === segments[index])\n ) {\n return;\n }\n this._segments = segments;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n if (width <= 0 || height <= 0 || this._segments.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const activeColor: Color = this._activeColor ?? { type: 'named', name: 'cyan' };\n const separatorChar = this._separator ?? (caps.unicode ? '❯' : '>');\n const ellipsis = caps.unicode ? '…' : '...';\n const sep = ` ${separatorChar} `;\n\n let visibleSegments = [...this._segments];\n let text = visibleSegments.join(sep);\n let tw = stringWidth(text);\n\n // Truncate from the left if it exceeds width\n while (tw > width && visibleSegments.length > 1) {\n visibleSegments.shift();\n text = ellipsis + sep + visibleSegments.join(sep);\n tw = stringWidth(text);\n }\n\n const hasTruncated = visibleSegments.length < this._segments.length;\n let showEllipsis = hasTruncated;\n \n // If width is so narrow that ellipsis + separator consumes all space,\n // hide them so at least part of the final segment stays visible.\n if (showEllipsis && visibleSegments.length === 1) {\n if (stringWidth(ellipsis + sep) >= width) {\n showEllipsis = false;\n }\n }\n \n let currentX = x;\n const renderList: Array<{ type: 'normal' | 'separator' | 'active', text: string }> = [];\n\n if (showEllipsis) {\n renderList.push({ type: 'normal', text: ellipsis });\n }\n\n for (let i = 0; i < visibleSegments.length; i++) {\n if (i > 0 || (showEllipsis && hasTruncated)) {\n renderList.push({ type: 'separator', text: sep });\n }\n const isLast = i === visibleSegments.length - 1;\n renderList.push({ \n type: isLast ? 'active' : 'normal', \n text: visibleSegments[i] \n });\n }\n\n // Render each part\n for (const item of renderList) {\n const itemWidth = stringWidth(item.text);\n if (currentX - x >= width) break;\n \n const remainingWidth = width - (currentX - x);\n const str = item.text;\n \n const itemAttrs = { ...attrs };\n if (item.type === 'active') {\n itemAttrs.fg = activeColor;\n }\n \n screen.writeString(currentX, y, truncate(str, remainingWidth, ''), itemAttrs);\n currentX += stringWidth(truncate(str, remainingWidth, ''));\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Avatar widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface AvatarOptions {\n /** Override the dynamically generated color */\n color?: Color;\n /** Shape of the avatar */\n shape?: 'square' | 'circle';\n}\n\n/**\n * Avatar — a widget that displays user initials with a generated color.\n */\nexport class Avatar extends Widget {\n private _name: string;\n private _color?: Color;\n private _shape: 'square' | 'circle';\n private _initials: string;\n private _fallbackColor: Color;\n\n constructor(name: string, style: Partial<Style> = {}, opts: AvatarOptions = {}) {\n super(style);\n this._name = name;\n this._color = opts.color;\n this._shape = opts.shape ?? 'square';\n this._initials = this._extractInitials(name);\n this._fallbackColor = this._generateColor(name);\n }\n\n setName(name: string): void {\n this._name = name;\n this._initials = this._extractInitials(name);\n this._fallbackColor = this._generateColor(name);\n this.markDirty();\n }\n\n getName(): string {\n return this._name;\n }\n\n setColor(color: Color): void {\n this._color = color;\n this.markDirty();\n }\n\n getColor(): Color | undefined {\n return this._color;\n }\n\n setShape(shape: 'square' | 'circle'): void {\n this._shape = shape;\n this.markDirty();\n }\n\n getShape(): 'square' | 'circle' {\n return this._shape;\n }\n\n private _extractInitials(name: string): string {\n if (!name) return '';\n const parts = name.trim().split(/\\s+/);\n if (parts.length === 0 || parts[0] === '') return '';\n let init = '';\n if (parts.length === 1) {\n init = parts[0].substring(0, 2).toUpperCase();\n } else {\n init = (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();\n }\n if (!caps.unicode) {\n init = init.replace(/[^\\x00-\\x7F]/g, '?');\n }\n return init;\n }\n\n private _generateColor(name: string): Color {\n if (!name) {\n return { type: 'named', name: 'white' };\n }\n let hash = 0;\n for (let i = 0; i < name.length; i++) {\n hash = name.charCodeAt(i) + ((hash << 5) - hash);\n }\n \n // Stable palette of colors\n const colors = [\n 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan',\n 'brightRed', 'brightGreen', 'brightYellow', 'brightBlue', 'brightMagenta', 'brightCyan'\n ] as const;\n \n const index = Math.abs(hash) % colors.length;\n return { type: 'named', name: colors[index] };\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const avatarColor = this._color ?? this._fallbackColor;\n\n let text = '';\n if (this._shape === 'circle') {\n text = `(${this._initials})`;\n } else {\n text = `[${this._initials}]`;\n }\n\n let renderText = '';\n let currentWidth = 0;\n for (const char of text) {\n const cw = stringWidth(char);\n if (currentWidth + cw > width) break;\n currentWidth += cw;\n renderText += char;\n }\n\n screen.writeString(x, y, renderText, {\n ...attrs,\n fg: avatarColor,\n bold: true,\n });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — BigText widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface BigTextOptions {\n /** Color for the rendered characters */\n color?: Color;\n}\n\n// 5×3 ASCII art character map (5 rows × 3 cols per char)\n// Each character is represented as an array of 5 strings, each 3 chars wide.\nconst CHAR_MAP: Record<string, string[]> = {\n 'A': [' # ', '# #', '###', '# #', '# #'],\n 'B': ['## ', '# #', '## ', '# #', '## '],\n 'C': [' ##', '# ', '# ', '# ', ' ##'],\n 'D': ['## ', '# #', '# #', '# #', '## '],\n 'E': ['###', '# ', '## ', '# ', '###'],\n 'F': ['###', '# ', '## ', '# ', '# '],\n 'G': [' ##', '# ', '# #', '# #', ' ##'],\n 'H': ['# #', '# #', '###', '# #', '# #'],\n 'I': ['###', ' # ', ' # ', ' # ', '###'],\n 'J': ['###', ' #', ' #', '# #', ' # '],\n 'K': ['# #', '## ', '# ', '## ', '# #'],\n 'L': ['# ', '# ', '# ', '# ', '###'],\n 'M': ['# #', '###', '# #', '# #', '# #'],\n 'N': ['# #', '## ', '# #', '# #', '# #'],\n 'O': [' # ', '# #', '# #', '# #', ' # '],\n 'P': ['## ', '# #', '## ', '# ', '# '],\n 'Q': [' # ', '# #', '# #', '##:', ' ##'],\n 'R': ['## ', '# #', '## ', '## ', '# #'],\n 'S': [' ##', '# ', ' # ', ' #', '## '],\n 'T': ['###', ' # ', ' # ', ' # ', ' # '],\n 'U': ['# #', '# #', '# #', '# #', '###'],\n 'V': ['# #', '# #', '# #', '# #', ' # '],\n 'W': ['# #', '# #', '# #', '###', '# #'],\n 'X': ['# #', '# #', ' # ', '# #', '# #'],\n 'Y': ['# #', '# #', ' # ', ' # ', ' # '],\n 'Z': ['###', ' #', ' # ', '# ', '###'],\n '0': [' # ', '# #', '# #', '# #', ' # '],\n '1': [' # ', '## ', ' # ', ' # ', '###'],\n '2': [' # ', '# #', ' # ', '# ', '###'],\n '3': ['## ', ' #', ' ##', ' #', '## '],\n '4': ['# #', '# #', '###', ' #', ' #'],\n '5': ['###', '# ', '## ', ' #', '## '],\n '6': [' # ', '# ', '## ', '# #', ' # '],\n '7': ['###', ' #', ' # ', '# ', '# '],\n '8': [' # ', '# #', ' # ', '# #', ' # '],\n '9': [' # ', '# #', ' ##', ' #', ' # '],\n ' ': [' ', ' ', ' ', ' ', ' '],\n '!': [' # ', ' # ', ' # ', ' ', ' # '],\n '.': [' ', ' ', ' ', ' ', ' # '],\n '-': [' ', ' ', '###', ' ', ' '],\n ':': [' ', ' # ', ' ', ' # ', ' '],\n};\n\nconst CHAR_HEIGHT = 5;\nconst CHAR_WIDTH = 3;\n\n/**\n * BigText — renders text as large 5×3 ASCII art banner characters.\n *\n * Supports A–Z (uppercase), 0–9, and common punctuation.\n * Unrecognized characters fall back to a narrow glyph.\n */\nexport class BigText extends Widget {\n private _text: string;\n private _color: Color;\n\n constructor(text: string, style: Partial<Style> = {}, opts: BigTextOptions = {}) {\n super(style);\n this._text = text.toUpperCase();\n this._color = opts.color ?? { type: 'named', name: 'white' };\n }\n\n setText(text: string): void {\n const normalized = text.toUpperCase();\n if (normalized === this._text) {\n return;\n }\n this._text = normalized;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const fg = this._color;\n\n let curX = x;\n\n for (const ch of this._text) {\n const glyph = CHAR_MAP[ch] ?? [' ', ' ', ' ', ' ', ' '];\n const glyphWidth = glyph[0]?.length ?? CHAR_WIDTH;\n\n if (curX + glyphWidth > x + width) break;\n\n for (let row = 0; row < CHAR_HEIGHT && row < height; row++) {\n const rowStr = glyph[row] ?? '';\n for (let col = 0; col < rowStr.length; col++) {\n if (rowStr[col] !== ' ') {\n screen.setCell(curX + col, y + row, {\n char: caps.unicode ? '█' : '#',\n ...attrs,\n fg\n });\n }\n }\n }\n\n // Advance with 1 col gap between characters\n curX += glyphWidth + 1;\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Gradient widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, caps, parseColor, shouldUseColor } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface GradientOptions {\n /** Start color (hex string like '#ff0000' or named color string) */\n startColor?: string;\n /** End color (hex string like '#0000ff' or named color string) */\n endColor?: string;\n /** Text alignment */\n align?: 'left' | 'center' | 'right';\n}\n\n/** Parse a hex color string to [r, g, b] */\nfunction hexToRgb(hex: string): [number, number, number] | null {\n const clean = hex.replace('#', '');\n if (clean.length !== 6) return null;\n const r = parseInt(clean.slice(0, 2), 16);\n const g = parseInt(clean.slice(2, 4), 16);\n const b = parseInt(clean.slice(4, 6), 16);\n if (isNaN(r) || isNaN(g) || isNaN(b)) return null;\n return [r, g, b];\n}\n\n/** Interpolate between two RGB values at t ∈ [0,1] */\nfunction lerpRgb(a: [number, number, number], b: [number, number, number], t: number): [number, number, number] {\n return [\n Math.round(a[0] + (b[0] - a[0]) * t),\n Math.round(a[1] + (b[1] - a[1]) * t),\n Math.round(a[2] + (b[2] - a[2]) * t),\n ];\n}\n\n/**\n * Gradient — text rendered with a smooth color gradient.\n *\n * Each character is colored by linearly interpolating between startColor and endColor.\n * Falls back to a single foreground color if true-color is unavailable.\n */\nexport class Gradient extends Widget {\n private _text: string;\n private _startColor: string;\n private _endColor: string;\n private _align: 'left' | 'center' | 'right';\n\n constructor(text: string, style: Partial<Style> = {}, opts: GradientOptions = {}) {\n super({ height: 1, ...style });\n this._text = text;\n this._startColor = opts.startColor ?? '#ff0000';\n this._endColor = opts.endColor ?? '#0000ff';\n this._align = opts.align ?? 'left';\n }\n\n setText(text: string): void {\n if (text === this._text) return;\n this._text = text;\n this.markDirty();\n }\n\n setColors(start: string, end: string): void {\n if (start === this._startColor && end === this._endColor) return;\n this._startColor = start;\n this._endColor = end;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0 || !this._text) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Without color support: render plain text with alignment applied\n if (!shouldUseColor()) {\n const plainChars = Array.from(this._text).slice(0, width);\n const plainLen = plainChars.length;\n let plainOffsetX = 0;\n if (this._align === 'center') plainOffsetX = Math.floor((width - plainLen) / 2);\n else if (this._align === 'right') plainOffsetX = width - plainLen;\n plainOffsetX = Math.max(0, plainOffsetX);\n screen.writeString(x + plainOffsetX, y, plainChars.join(''), attrs);\n return;\n }\n\n const startRgb = hexToRgb(this._startColor);\n const endRgb = hexToRgb(this._endColor);\n\n const chars = Array.from(this._text).slice(0, width);\n const len = chars.length;\n\n // Alignment offset\n let offsetX = 0;\n if (this._align === 'center') offsetX = Math.floor((width - len) / 2);\n else if (this._align === 'right') offsetX = width - len;\n offsetX = Math.max(0, offsetX);\n\n for (let i = 0; i < chars.length; i++) {\n const t = len > 1 ? i / (len - 1) : 0;\n\n let fg: import('@termuijs/core').Color;\n\n if (startRgb && endRgb) {\n const [r, g, b] = lerpRgb(startRgb, endRgb, t);\n fg = { type: 'rgb', r, g, b };\n } else if (startRgb) {\n // Fallback: use start color parsed as hex\n fg = parseColor(this._startColor) ?? attrs.fg;\n } else {\n fg = attrs.fg;\n }\n\n screen.setCell(x + offsetX + i, y, { char: chars[i] ?? ' ', ...attrs, fg });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Markdown widget\n// ─────────────────────────────────────────────────────\n\nimport { Screen, Style, caps, wordWrap, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface MarkdownOptions {\n content: string;\n}\n\n// ── Markdown widget ──────────────────────────────────\n\n/**\n * Markdown — renders a subset of Markdown syntax in the terminal.\n *\n * Supported:\n * - Headings (#)\n * - Bold (**text**)\n * - Italic (_text_)\n * - Inline code (`code`)\n * - Unordered lists (- item)\n * - Ordered lists (1. item)\n * - Code fences (```lang)\n */\n\nconst segmenter = new Intl.Segmenter();\n\nexport class Markdown extends Widget {\n private _content: string;\n\n private writeText(\n screen: Screen,\n x: number,\n y: number,\n text: string,\n attrs: Record<string, unknown> = {}\n ): void {\n screen.writeString(x, y, text, attrs);\n }\n\n private renderInline(screen: Screen, x: number, y: number, text: string): void {\n text = text.replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, '$1 ($2)');\n let bold = false;\n let italic = false;\n let code = false;\n let col = x;\n let segmentStr = '';\n\n const flush = () => {\n if (segmentStr.length === 0) return;\n screen.writeString(col - stringWidth(segmentStr), y, segmentStr, {\n bold,\n italic,\n inverse: code\n });\n segmentStr = '';\n };\n\n const segments = segmenter.segment(text);\n const segmentsArray = Array.from(segments);\n\n for (let i = 0; i < segmentsArray.length; i++) {\n const seg = segmentsArray[i].segment;\n \n if (seg === '*' && i + 1 < segmentsArray.length && segmentsArray[i+1].segment === '*') {\n flush();\n bold = !bold;\n i++;\n continue;\n }\n if (seg === '_') {\n flush();\n italic = !italic;\n continue;\n }\n if (seg === '`') {\n flush();\n code = !code;\n continue;\n }\n segmentStr += seg;\n col += stringWidth(seg);\n }\n flush();\n }\n private renderCodeBlock(\n screen: Screen,\n x: number,\n y: number,\n width: number,\n language: string,\n lines: string[]\n ): number {\n const tl = caps.unicode ? '┌' : '+';\n const tr = caps.unicode ? '┐' : '+';\n const hl = caps.unicode ? '─' : '-';\n const vl = caps.unicode ? '│' : '|';\n const bl = caps.unicode ? '└' : '+';\n const br = caps.unicode ? '┘' : '+';\n const top = `${tl}${hl} ${language} ${hl.repeat(Math.max(0, width - language.length - 5))}${tr}`;\n\n this.writeText(screen, x, y, top);\n\n for (let i = 0; i < lines.length; i++) {\n this.writeText(\n screen,\n x,\n y + i + 1,\n `${vl} ${lines[i]}`\n );\n }\n\n const bottom = `${bl}${hl.repeat(Math.max(0, width - 2))}${br}`;\n\n this.writeText(\n screen,\n x,\n y + lines.length + 1,\n bottom\n );\n\n return lines.length + 2;\n }\n\n constructor(options: MarkdownOptions, style: Partial<Style> = {}) {\n super(style);\n this._content = options.content;\n }\n\n /** Update markdown content and mark dirty. */\n\n setContent(content: string): void {\n this._content = content;\n this.markDirty();\n }\n\n getContent(): string {\n return this._content;\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n\n const lines = this._content.split('\\n');\n\n let screenRow = 0;\n\n for (let row = 0; row < lines.length && row < rect.height; row++) {\n const line = lines[row];\n\n if (line.startsWith('```')) {\n const language = line.slice(3).trim();\n\n const codeLines: string[] = [];\n\n row++;\n screenRow++;\n\n while (\n row < lines.length &&\n !lines[row].startsWith('```')\n ) {\n codeLines.push(lines[row]);\n row++;\n }\n\n screenRow += this.renderCodeBlock(\n screen,\n rect.x,\n rect.y + screenRow,\n rect.width,\n language,\n codeLines\n );\n\n continue;\n }\n\n if (line.startsWith('# ')) {\n screen.writeString(rect.x, rect.y + screenRow, line.slice(2), {\n bold: true,\n underline: true\n });\n screenRow++;\n }\n\n else if (line.startsWith('> ')) {\n screen.writeString(\n rect.x,\n rect.y + screenRow,\n `│ ${line.slice(2)}`,\n {\n italic: true\n }\n );\n\n screenRow++;\n}\n else if (line.startsWith('- ')) {\n const bullet = caps.unicode ? '•' : '*';\n\n this.renderInline(\n screen,\n rect.x,\n rect.y + screenRow,\n `${bullet} ${line.slice(2)}`\n );\n screenRow++;\n }\n else if (/^\\d+\\.\\s/.test(line)) {\n this.renderInline(\n screen,\n rect.x,\n rect.y + screenRow,\n line\n );\n screenRow++;\n }\n else {\n const wrapped = wordWrap(line, rect.width);\n\n const wrappedLines = wrapped.split('\\n');\n\n for (let i = 0; i < wrappedLines.length; i++) {\n if (row + i >= rect.height) break;\n\n this.renderInline(\n screen,\n rect.x,\n rect.y + screenRow + i,\n wrappedLines[i]\n );\n }\n screenRow += wrappedLines.length;\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Code widget\n// ─────────────────────────────────────────────────────\n\nimport { caps, getBorderChars, styleToCellAttrs } from '@termuijs/core';\nimport { type Screen, type Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface CodeOptions {\n language?: string;\n showLineNumbers?: boolean;\n}\n\nexport class Code extends Widget {\n private _code: string;\n private _language: string;\n private _showLineNumbers: boolean;\n\n constructor(code: string, style: Partial<Style> = {}, opts: CodeOptions = {}) {\n const mergedStyle: Partial<Style> = { border: 'round', ...style };\n super(mergedStyle);\n this._code = code;\n this._language = opts.language ?? '';\n this._showLineNumbers = opts.showLineNumbers ?? true;\n }\n\n setCode(code: string): void {\n this._code = code;\n this.markDirty();\n }\n\n setLanguage(language: string): void {\n this._language = language;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const lines = this._code.split('\\n');\n const maxLineNum = lines.length;\n const lineNumWidth = this._showLineNumbers ? String(maxLineNum).length : 0;\n\n for (let i = 0; i < lines.length && i < rect.height; i++) {\n let x = rect.x;\n const y = rect.y + i;\n\n if (this._showLineNumbers && lineNumWidth > 0) {\n const lineNum = String(i + 1).padStart(lineNumWidth);\n screen.writeString(x, y, lineNum, { dim: true });\n x += lineNumWidth;\n\n screen.setCell(x, y, { char: '│', dim: true });\n x++;\n\n screen.setCell(x, y, { char: ' ' });\n x++;\n }\n\n const codeLine = lines[i];\n screen.writeString(x, y, codeLine);\n }\n }\n\n protected _renderBorder(screen: Screen): void {\n const border = this._style.border;\n const hasBorder = border && border !== 'none';\n if (!hasBorder) return;\n\n const { x, y, width, height } = this._rect;\n if (width < 2 || height < 2) return;\n\n const chars = getBorderChars(border);\n if (!chars) return;\n\n const attrs = styleToCellAttrs(this._style);\n const borderFg = this._style.borderColor ?? attrs.fg;\n const cellStyle = { fg: borderFg };\n\n // Top edge with language label\n const label = this._language ? `[${this._language}]` : '';\n\n screen.setCell(x, y, { char: chars.topLeft, ...cellStyle });\n\n if (label) {\n screen.setCell(x + 1, y, { char: chars.top, ...cellStyle });\n for (let i = 0; i < label.length; i++) {\n screen.setCell(x + 2 + i, y, { char: label[i], ...cellStyle, bold: true });\n }\n for (let c = 2 + label.length; c < width - 1; c++) {\n screen.setCell(x + c, y, { char: chars.top, ...cellStyle });\n }\n } else {\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y, { char: chars.top, ...cellStyle });\n }\n }\n screen.setCell(x + width - 1, y, { char: chars.topRight, ...cellStyle });\n\n // Bottom edge\n screen.setCell(x, y + height - 1, { char: chars.bottomLeft, ...cellStyle });\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y + height - 1, { char: chars.bottom, ...cellStyle });\n }\n screen.setCell(x + width - 1, y + height - 1, { char: chars.bottomRight, ...cellStyle });\n\n // Left and right edges\n for (let r = 1; r < height - 1; r++) {\n screen.setCell(x, y + r, { char: chars.left, ...cellStyle });\n screen.setCell(x + width - 1, y + r, { char: chars.right, ...cellStyle });\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Badge widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type BadgeVariant = 'info' | 'success' | 'warning' | 'error' | 'neutral';\n\nexport interface BadgeOptions {\n /** Variant determines background color. Default: 'neutral'. */\n variant?: BadgeVariant;\n}\n\n/** Background colors for each variant. */\nconst BG_COLORS: Record<BadgeVariant, Color> = {\n info: { type: 'named', name: 'cyan' },\n success: { type: 'named', name: 'green' },\n warning: { type: 'named', name: 'yellow' },\n error: { type: 'named', name: 'red' },\n neutral: { type: 'named', name: 'white' },\n};\n\n/** Foreground color — black for readability on colored backgrounds. */\nconst FG_COLOR: Color = { type: 'named', name: 'black' };\n\n/**\n * Badge — a short inline label with a colored background.\n *\n * Used for status indicators such as \"online\", \"error\", \"beta\".\n * Renders a bordered box with the text on a colored background.\n * Uses `caps.unicode` to choose between Unicode box-drawing and ASCII fallback.\n *\n * CONSTRUCTOR: (text, style?, opts?)\n */\nexport class Badge extends Widget {\n private _text: string;\n private _variant: BadgeVariant;\n\n constructor(text: string, style?: Partial<Style>, opts?: BadgeOptions) {\n super(style ?? {});\n this._text = text;\n this._variant = opts?.variant ?? 'neutral';\n }\n\n /** Update the badge text. */\n setText(text: string): void {\n if (text === this._text) return; \n this._text = text;\n this.markDirty();\n }\n\n /** Get the current badge text. */\n getText(): string {\n return this._text;\n }\n\n /** Update the badge variant. */\n setVariant(variant: BadgeVariant): void {\n if (variant === this._variant) return;\n this._variant = variant;\n this.markDirty();\n }\n\n /** Get the current badge variant. */\n getVariant(): BadgeVariant {\n return this._variant;\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width <= 0 || height <= 0) return;\n\n const bg = BG_COLORS[this._variant];\n const fg = FG_COLOR;\n\n // Choose border characters based on unicode support\n const tl = caps.unicode ? '┌' : '+';\n const tr = caps.unicode ? '┐' : '+';\n const bl = caps.unicode ? '└' : '+';\n const br = caps.unicode ? '┘' : '+';\n const hz = caps.unicode ? '─' : '-';\n const vt = caps.unicode ? '│' : '|';\n\n const borderAttrs = { fg: bg };\n const contentAttrs = { fg, bg, bold: true };\n\n // Padded text: \" text \"\n const padded = ` ${this._text} `;\n const textWidth = stringWidth(padded);\n\n // Inner width is the area between left and right border\n const innerWidth = Math.min(textWidth, Math.max(0, width - 2));\n\n // ── Row 0: top border ──\n if (height >= 1) {\n screen.setCell(x, y, { char: tl, ...borderAttrs });\n for (let c = 1; c <= innerWidth; c++) {\n screen.setCell(x + c, y, { char: hz, ...borderAttrs });\n }\n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y, { char: tr, ...borderAttrs });\n }\n }\n\n // ── Row 1: content row ──\n if (height >= 2) {\n screen.setCell(x, y + 1, { char: vt, ...borderAttrs });\n\n // Write padded text with colored background\n const visibleText = padded.slice(0, innerWidth);\n screen.writeString(x + 1, y + 1, visibleText, contentAttrs);\n\n // Fill remaining inner space with background\n const written = stringWidth(visibleText);\n for (let c = written; c < innerWidth; c++) {\n screen.setCell(x + 1 + c, y + 1, { char: ' ', ...contentAttrs });\n }\n\n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y + 1, { char: vt, ...borderAttrs });\n }\n }\n\n // ── Row 2: bottom border ──\n if (height >= 3) {\n screen.setCell(x, y + 2, { char: bl, ...borderAttrs });\n for (let c = 1; c <= innerWidth; c++) {\n screen.setCell(x + c, y + 2, { char: hz, ...borderAttrs });\n }\n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y + 2, { char: br, ...borderAttrs });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Kbd widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface KbdOptions {\n color?: Color;\n}\n\nconst BG_COLOR: Color = { type: 'named', name: 'white' };\nconst FG_COLOR: Color = { type: 'named', name: 'black' };\n\n/**\n * Kbd — an inline label representing a keyboard input.\n *\n * Used for displaying hotkeys or shortcuts (e.g., \"Ctrl+C\").\n * Renders an inline block with a distinct background to simulate a key press.\n */\nexport class Kbd extends Widget {\n private _keys: string;\n private _opts: KbdOptions;\n\n constructor(keys: string, style?: Partial<Style>, opts?: KbdOptions) {\n super(style || {});\n this._keys = keys;\n this._opts = opts || {};\n }\n\n /** Update the kbd keys. */\n setKeys(keys: string): void {\n if (this._keys === keys) return; \n this._keys = keys;\n this.markDirty();\n }\n\n /** Get the current kbd keys. */\n getKeys(): string {\n return this._keys;\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width <= 0 || height <= 0) return;\n\n const bg = BG_COLOR;\n const fg = FG_COLOR;\n \n // Use opts.color for border if provided, otherwise default to background color\n const borderColor = this._opts.color || bg;\n\n const textAttrs = { fg, bg, bold: false };\n const borderAttrs = { fg: borderColor, bg, bold: false };\n \n // Separator style uses standard widget style fallback\n const sepAttrs = { \n fg: this._style.fg || { type: 'named', name: 'white' }, \n bg: this._style.bg || { type: 'named', name: 'black' }, \n bold: false \n };\n\n const leftBracket = caps.unicode ? '⟨' : '[';\n const rightBracket = caps.unicode ? '⟩' : ']';\n\n // Split the keys by '+' and trim any accidental whitespace\n const parts = this._keys.split('+').map(p => p.trim());\n let currentX = x;\n\n if (height >= 1) {\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n const padded = ` ${part} `;\n const partWidth = stringWidth(padded) + 2; // +2 for brackets\n\n // Stop rendering if we exceed the widget's allocated width\n if (currentX - x + partWidth > width) break;\n\n // Draw left bracket\n screen.setCell(currentX, y, { char: leftBracket, ...borderAttrs });\n\n // Draw the padded text\n const visibleText = padded.slice(0, partWidth - 2);\n screen.writeString(currentX + 1, y, visibleText, textAttrs);\n\n // Draw right bracket\n screen.setCell(currentX + partWidth - 1, y, { char: rightBracket, ...borderAttrs });\n\n currentX += partWidth;\n\n // Draw separator ' + ' if not the last keycap\n if (i < parts.length - 1) {\n const sep = ' + ';\n if (currentX - x + stringWidth(sep) <= width) {\n screen.writeString(currentX, y, sep, sepAttrs);\n currentX += stringWidth(sep);\n }\n }\n }\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Tag widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, stringWidth, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type TagVariant = 'info' | 'success' | 'warning' | 'error' | 'neutral';\n\nexport interface TagOptions {\n /** Variant determines border and text color. Default: 'neutral'. */\n variant?: TagVariant;\n}\n\n/** Foreground colors for each variant (used for border + text). */\nconst FG_COLORS: Record<TagVariant, Color> = {\n info: { type: 'named', name: 'cyan' },\n success: { type: 'named', name: 'green' },\n warning: { type: 'named', name: 'yellow' },\n error: { type: 'named', name: 'red' },\n neutral: { type: 'named', name: 'white' },\n};\n\n/**\n * Tag — a short inline label with a colored border and no background fill.\n *\n * Used for categorical labels such as \"typescript\", \"react\", \"v2.0\".\n * Renders a bordered box with the text colored by variant but no background.\n * Uses `caps.unicode` to choose between Unicode box-drawing and ASCII fallback.\n *\n * CONSTRUCTOR: (text, style?, opts?)\n */\nexport class Tag extends Widget {\n private _text: string;\n private _variant: TagVariant;\n\n constructor(text: string, style?: Partial<Style>, opts?: TagOptions) {\n super(style ?? {});\n this._text = text;\n this._variant = opts?.variant ?? 'neutral';\n }\n\n /** Update the tag text. */\n setText(text: string): void {\n if (text === this._text) return;\n\n this._text = text;\n this.markDirty();\n }\n\n /** Get the current tag text. */\n getText(): string {\n return this._text;\n }\n\n /** Update the tag variant. */\n setVariant(variant: TagVariant): void {\n if (variant === this._variant) return;\n\n this._variant = variant;\n this.markDirty();\n }\n\n /** Get the current tag variant. */\n getVariant(): TagVariant {\n return this._variant;\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width <= 0 || height <= 0) return;\n\n const fg = FG_COLORS[this._variant];\n\n // Choose border characters based on unicode support\n const tl = caps.unicode ? '┌' : '+';\n const tr = caps.unicode ? '┐' : '+';\n const bl = caps.unicode ? '└' : '+';\n const br = caps.unicode ? '┘' : '+';\n const hz = caps.unicode ? '─' : '-';\n const vt = caps.unicode ? '│' : '|';\n\n const borderAttrs = { fg };\n const textAttrs = { fg };\n\n // Padded text: \" text \"\n const padded = ` ${this._text} `;\n const textWidth = stringWidth(padded);\n\n // Inner width is the area between left and right border\n const innerWidth = Math.min(textWidth, Math.max(0, width - 2));\n\n // ── Row 0: top border ──\n if (height >= 1) {\n screen.setCell(x, y, { char: tl, ...borderAttrs });\n for (let c = 1; c <= innerWidth; c++) {\n screen.setCell(x + c, y, { char: hz, ...borderAttrs });\n }\n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y, { char: tr, ...borderAttrs });\n }\n }\n\n // ── Row 1: content row (no background fill) ──\n if (height >= 2) {\n screen.setCell(x, y + 1, { char: vt, ...borderAttrs });\n\n // Write padded text with variant foreground, no background\n const visibleText = padded.slice(0, innerWidth);\n screen.writeString(x + 1, y + 1, visibleText, textAttrs);\n\n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y + 1, { char: vt, ...borderAttrs });\n }\n }\n\n // ── Row 2: bottom border ──\n if (height >= 3) {\n screen.setCell(x, y + 2, { char: bl, ...borderAttrs });\n for (let c = 1; c <= innerWidth; c++) {\n screen.setCell(x + c, y + 2, { char: hz, ...borderAttrs });\n }\n if (innerWidth + 1 < width) {\n screen.setCell(x + innerWidth + 1, y + 2, { char: br, ...borderAttrs });\n }\n }\n }\n}\n","// -----------------------------------------------------------------------------\n// @termuijs/widgets - Placeholder widget\n// -----------------------------------------------------------------------------\n\nimport { type Screen, type Style, type Color, caps, stringWidth, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface PlaceholderOptions {\n /** Fill character. Default: '░' with ASCII fallback '.' */\n fillChar?: string;\n borderColor?: Color;\n labelColor?: Color;\n}\n\n/**\n * Placeholder - a labeled stand-in box for prototyping terminal layouts.\n */\nexport class Placeholder extends Widget {\n private _label: string;\n private _fillChar?: string;\n private _borderColor?: Color;\n private _labelColor?: Color;\n\n constructor(label: string, style: Partial<Style> = {}, opts: PlaceholderOptions = {}) {\n super(style);\n this._label = label;\n this._fillChar = opts.fillChar;\n this._borderColor = opts.borderColor;\n this._labelColor = opts.labelColor;\n }\n\n setLabel(label: string): void {\n if (this._label === label) return;\n this._label = label;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const fillAttrs = { ...attrs };\n const borderAttrs = { ...attrs, fg: this._borderColor };\n const labelAttrs = { ...attrs, fg: this._labelColor };\n\n const fillChar = this._fillChar ?? (caps.unicode ? '\\u2591' : '.');\n const tl = caps.unicode ? '\\u250c' : '+';\n const tr = caps.unicode ? '\\u2510' : '+';\n const bl = caps.unicode ? '\\u2514' : '+';\n const br = caps.unicode ? '\\u2518' : '+';\n const hz = caps.unicode ? '\\u2500' : '-';\n const vt = caps.unicode ? '\\u2502' : '|';\n\n for (let row = 0; row < height; row++) {\n for (let col = 0; col < width; col++) {\n screen.setCell(x + col, y + row, { char: fillChar, ...fillAttrs });\n }\n }\n\n for (let col = 0; col < width; col++) {\n screen.setCell(x + col, y, { char: hz, ...borderAttrs });\n screen.setCell(x + col, y + height - 1, { char: hz, ...borderAttrs });\n }\n\n for (let row = 0; row < height; row++) {\n screen.setCell(x, y + row, { char: vt, ...borderAttrs });\n screen.setCell(x + width - 1, y + row, { char: vt, ...borderAttrs });\n }\n\n screen.setCell(x, y, { char: tl, ...borderAttrs });\n screen.setCell(x + width - 1, y, { char: tr, ...borderAttrs });\n screen.setCell(x, y + height - 1, { char: bl, ...borderAttrs });\n screen.setCell(x + width - 1, y + height - 1, { char: br, ...borderAttrs });\n\n if (width <= 2 || height <= 2 || this._label.length === 0) return;\n\n const innerWidth = width - 2;\n const visibleLabel = this._label.slice(0, innerWidth);\n const labelWidth = Math.min(stringWidth(visibleLabel), innerWidth);\n const labelX = x + 1 + Math.max(0, Math.floor((innerWidth - labelWidth) / 2));\n const labelY = y + Math.floor(height / 2);\n\n screen.writeString(labelX, labelY, visibleLabel, labelAttrs);\n }\n}\n","// -----------------------------------------------------------------------------\n// @termuijs/widgets - Watermark widget\n// -----------------------------------------------------------------------------\n\nimport { type Screen, type Style, type Color, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface WatermarkOptions {\n /** Color of the repeated text. Default: brightBlack */\n color?: Color;\n /** Diagonal tilt angle in characters. 0 = horizontal rows. Default: 0 */\n angle?: 0 | 45;\n}\n\nconst segmenter = new Intl.Segmenter();\n\n/**\n * Watermark - fills its area with faint repeating text.\n */\nexport class Watermark extends Widget {\n private _text: string;\n private _color: Color;\n private _angle: 0 | 45;\n\n constructor(text: string, style: Partial<Style> = {}, opts: WatermarkOptions = {}) {\n super(style);\n this._text = text;\n this._color = opts.color ?? { type: 'named', name: 'brightBlack' };\n this._angle = opts.angle ?? 0;\n }\n\n setText(text: string): void {\n if (this._text === text) return;\n this._text = text;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n if (width <= 0 || height <= 0 || this._text.length === 0) return;\n\n const attrs = { ...styleToCellAttrs(this._style), fg: this._color };\n const rowOffsetStep = this._angle === 45 ? 1 : 0;\n \n const segments = Array.from(segmenter.segment(this._text)).map(s => s.segment);\n if (segments.length === 0) return;\n\n for (let row = 0; row < height; row++) {\n let col = 0;\n // row * rowOffsetStep produces the 45° horizontal offset per row\n // row * width contributes to linearizing row/col into the segments index\n let index = (row * width + row * rowOffsetStep) % segments.length;\n \n while (col < width) {\n const char = segments[index];\n screen.setCell(x + col, y + row, {\n char,\n ...attrs,\n });\n // TODO: we should handle double-width characters by skipping the next column if width=2\n // but since Watermark traditionally filled cell by cell, we just let it be.\n col++;\n index = (index + 1) % segments.length;\n }\n }\n }\n}\n","// @termuijs/widgets - NotificationBadge widget\n\nimport { type Screen, type Style, type Color, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type BadgePosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';\n\nexport interface NotificationBadgeOptions {\n /** Notification count to display. Default: 0. */\n count?: number;\n /** Corner position for the badge. Default: 'top-right'. */\n position?: BadgePosition;\n}\n\n/** Badge background: red, the universal notification color. */\nconst BADGE_BG: Color = { type: 'named', name: 'red' };\n\n/** Badge foreground: white for contrast on red. */\nconst BADGE_FG: Color = { type: 'named', name: 'white' };\n\n/**\n * NotificationBadge - a small count label rendered at a corner position.\n *\n * Used for unread counts, alert indicators, and notification overlays.\n * Renders the count as a compact colored label at one of four corner positions.\n * Shows \"99+\" when the count exceeds 99. Renders nothing when count is 0.\n */\nexport class NotificationBadge extends Widget {\n private _count: number;\n private _position: BadgePosition;\n\n constructor(opts: NotificationBadgeOptions = {}, style: Partial<Style> = {}) {\n super(style);\n this._count = opts.count ?? 0;\n this._position = opts.position ?? 'top-right';\n }\n\n /** Update the notification count. */\n setCount(count: number): void {\n if (count === this._count) return;\n this._count = count;\n this.markDirty();\n }\n\n /** Get the current notification count. */\n getCount(): number {\n return this._count;\n }\n\n /** Update the badge position. */\n setPosition(position: BadgePosition): void {\n if (position === this._position) return;\n this._position = position;\n this.markDirty();\n }\n\n /** Get the current badge position. */\n getPosition(): BadgePosition {\n return this._position;\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width <= 0 || height <= 0) return;\n\n // Show nothing when count is zero\n if (this._count === 0) return;\n\n // Format the label: \"99+\" for counts over 99\n const label = this._count > 99 ? '99+' : String(this._count);\n const labelWidth = stringWidth(label);\n\n // Compute badge position based on corner setting\n let bx: number;\n let by: number;\n\n switch (this._position) {\n case 'top-left':\n bx = x;\n by = y;\n break;\n case 'top-right':\n bx = x + width - labelWidth;\n by = y;\n break;\n case 'bottom-left':\n bx = x;\n by = y + height - 1;\n break;\n case 'bottom-right':\n bx = x + width - labelWidth;\n by = y + height - 1;\n break;\n }\n\n // Clamp to widget bounds\n bx = Math.max(x, bx);\n\n // Render the label with notification colors\n const attrs = { fg: BADGE_FG, bg: BADGE_BG, bold: true };\n screen.writeString(bx, by, label, attrs);\n }\n}\n","import {\n type Screen,\n type Style,\n type KeyEvent,\n styleToCellAttrs,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface CarouselOptions {\n loop?: boolean;\n showDots?: boolean;\n showArrows?: boolean;\n}\n\nexport class Carousel extends Widget {\n private _items: string[];\n private _index = 0;\n private _opts: Required<CarouselOptions>;\n\n constructor(\n items: string[],\n style: Partial<Style> = {},\n opts: CarouselOptions = {},\n ) {\n super(style);\n\n this._items = items;\n this._opts = {\n loop: opts.loop ?? false,\n showDots: opts.showDots ?? true,\n showArrows: opts.showArrows ?? true,\n };\n\n this.focusable = true;\n }\n\n getIndex(): number {\n return this._index;\n }\n\n setIndex(index: number): void {\n if (this._items.length === 0) {\n this._index = 0;\n } else {\n this._index = Math.max(\n 0,\n Math.min(index, this._items.length - 1),\n );\n }\n\n this.markDirty();\n }\n\n next(): void {\n if (this._items.length === 0) return;\n\n if (this._index >= this._items.length - 1) {\n if (this._opts.loop) {\n this._index = 0;\n }\n } else {\n this._index++;\n }\n\n this.markDirty();\n }\n\n prev(): void {\n if (this._items.length === 0) return;\n\n if (this._index <= 0) {\n if (this._opts.loop) {\n this._index = this._items.length - 1;\n }\n } else {\n this._index--;\n }\n\n this.markDirty();\n }\n\n setItems(items: string[]): void {\n this._items = items;\n\n if (this._index >= items.length) {\n this._index = Math.max(0, items.length - 1);\n }\n\n this.markDirty();\n }\n\n handleKey(event: KeyEvent): void {\n switch (event.key) {\n case 'left':\n case 'h':\n this.prev();\n break;\n\n case 'right':\n case 'l':\n this.next();\n break;\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n const item = this._items[this._index] ?? '';\n\n const leftArrow = this._opts.showArrows\n ? caps.unicode\n ? '◄ '\n : '< '\n : '';\n\n const rightArrow = this._opts.showArrows\n ? caps.unicode\n ? ' ►'\n : ' >'\n : '';\n\n const header =\n `${leftArrow}Item ${this._index + 1} of ${this._items.length}: ${item}${rightArrow}`;\n\n screen.writeString(\n x,\n y,\n header.slice(0, width),\n attrs,\n );\n\n if (height >= 2 && this._opts.showDots) {\n const activeDot = caps.unicode ? '●' : '*';\n const inactiveDot = caps.unicode ? '○' : '.';\n\n const dots = this._items\n .map((_, i) =>\n i === this._index ? activeDot : inactiveDot,\n )\n .join(' ');\n\n screen.writeString(\n x,\n y + 1,\n dots.slice(0, width),\n attrs,\n );\n }\n }\n}\n\n","// @termuijs/widgets — Tooltip widget\n\nimport { type Screen, type Style, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface TooltipOptions {\n text: string;\n visible: boolean;\n}\n\n/**\n * Tooltip — displays contextual help text.\n *\n * The widget renders within its own assigned rect.\n * The parent is responsible for positioning it via updateRect().\n */\nexport class Tooltip extends Widget {\n private _text: string;\n private _visible: boolean;\n\n constructor(options: TooltipOptions, style: Partial<Style> = {}) {\n super(style);\n\n this._text = options.text;\n this._visible = options.visible;\n }\n\n protected _renderSelf(screen: Screen): void {\n if (!this._visible) return;\n\n const { x, y, width, height } = this._rect;\n\n if (width <= 0 || height <= 0) return;\n\n const tl = caps.unicode ? '┌' : '+';\n const tr = caps.unicode ? '┐' : '+';\n const bl = caps.unicode ? '└' : '+';\n const br = caps.unicode ? '┘' : '+';\n const hz = caps.unicode ? '─' : '-';\n const vt = caps.unicode ? '│' : '|';\n\n // Top border\n screen.setCell(x, y, { char: tl });\n\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y, { char: hz });\n }\n\n if (width > 1) {\n screen.setCell(x + width - 1, y, { char: tr });\n }\n\n // Content row\n if (height >= 2) {\n screen.setCell(x, y + 1, { char: vt });\n\n const content = this._text\n .slice(0, Math.max(0, width - 2))\n .padEnd(Math.max(0, width - 2), ' ');\n\n screen.writeString(x + 1, y + 1, content);\n\n if (width > 1) {\n screen.setCell(x + width - 1, y + 1, { char: vt });\n }\n }\n\n // Bottom border\n if (height >= 3) {\n screen.setCell(x, y + height - 1, { char: bl });\n\n for (let c = 1; c < width - 1; c++) {\n screen.setCell(x + c, y + height - 1, { char: hz });\n }\n\n if (width > 1) {\n screen.setCell(x + width - 1, y + height - 1, {\n char: br,\n });\n }\n }\n }\n\n setText(text: string): void {\n if (this._text === text) return;\n this._text = text;\n this.markDirty();\n }\n\n getText(): string {\n return this._text;\n }\n\n setVisible(visible: boolean): void {\n if (this._visible === visible) return;\n this._visible = visible;\n this.markDirty();\n }\n\n getVisible(): boolean {\n return this._visible;\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Panel widget\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type Color,\n styleToCellAttrs,\n stringWidth,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface PanelOptions {\n /** Required title shown in the top border */\n title: string;\n /** Optional color for the border and title */\n borderColor?: Color;\n}\n\n/**\n * Panel — a labeled container widget.\n *\n * A Box with a required title rendered inside the top border line.\n * Use it as a labeled container for grouping related content.\n *\n * Unicode: ╭─ My Panel ──────╮\n * ASCII: +-- My Panel -----+\n */\nexport class Panel extends Widget {\n private _title: string;\n private _borderColor?: Color;\n\n constructor(style: Partial<Style> = {}, opts: PanelOptions) {\n super({\n border: 'single',\n padding: 1,\n ...style,\n });\n this._title = opts.title;\n this._borderColor = opts.borderColor;\n }\n\n setTitle(title: string): void {\n this._title = title;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width } = this._rect;\n if (width < 4) return;\n\n const attrs = styleToCellAttrs(this._style);\n const fg = this._borderColor ?? attrs.fg;\n\n // Title rendered into top border: ─ Title ─\n const titleText = ` ${this._title} `;\n const titleWidth = stringWidth(titleText);\n const innerWidth = width - 2; // minus corners\n\n if (titleWidth > innerWidth) return;\n\n // Place title at x+1 (after corner char)\n const titleX = x + 1;\n screen.writeString(titleX, y, titleText, { ...attrs, fg, bold: true });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Clock widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\nimport { Digits } from './Digits.js';\n\nexport interface ClockOptions {\n showSeconds?: boolean;\n use24Hour?: boolean;\n digitColor?: Color;\n}\n\nexport class Clock extends Widget {\n private _showSeconds: boolean;\n private _use24Hour: boolean;\n private _digits: Digits;\n private _digitColor: Color;\n private _ampm: string = '';\n private _digitPartLength: number = 0;\n\n constructor(style: Partial<Style> = {}, opts: ClockOptions = {}) {\n super(style);\n this._showSeconds = opts.showSeconds ?? true;\n this._use24Hour = opts.use24Hour ?? true;\n this._digitColor = opts.digitColor ?? { type: 'named', name: 'white' };\n\n // Strip layout and border styles from style passed to Digits\n const { border, padding, margin, width, height, ...digitsStyle } = style;\n this._digits = new Digits(digitsStyle, { color: this._digitColor });\n\n // Initialize with current time\n this.setTime(new Date());\n }\n\n setTime(time: Date): void {\n const hours = time.getHours();\n const minutes = time.getMinutes();\n const seconds = time.getSeconds();\n\n const minStr = String(minutes).padStart(2, '0');\n const secStr = String(seconds).padStart(2, '0');\n\n let digitPart: string;\n let ampmPart: string = '';\n\n if (this._use24Hour) {\n const hourStr = String(hours).padStart(2, '0');\n digitPart = this._showSeconds \n ? `${hourStr}:${minStr}:${secStr}` \n : `${hourStr}:${minStr}`;\n } else {\n ampmPart = hours >= 12 ? 'PM' : 'AM';\n const displayHour = hours % 12 === 0 ? 12 : hours % 12;\n const hourStr = String(displayHour);\n digitPart = this._showSeconds \n ? `${hourStr}:${minStr}:${secStr}` \n : `${hourStr}:${minStr}`;\n }\n\n this._digits.setValue(digitPart);\n this._ampm = ampmPart;\n this._digitPartLength = digitPart.length;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n // Position and render the internal digits widget\n this._digits.updateRect(rect);\n this._digits.render(screen);\n\n // If in 12h mode, render AM/PM text separately\n if (this._ampm) {\n const digitsWidth = this._digitPartLength * 5; // each digit consumes 5 columns\n\n if (digitsWidth + this._ampm.length <= width && height >= 3) {\n const attrs = styleToCellAttrs(this._style);\n screen.writeString(x + digitsWidth, y + 2, this._ampm, { ...attrs, fg: this._digitColor });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Digits widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface DigitsOptions {\n color?: Color;\n}\n\n// 3-row × 4-col ASCII art digit map\n// Each digit is 4 columns wide, 3 rows tall\nconst DIGIT_MAP: Record<string, string[]> = {\n '0': ['.--.', '| |', \"'--'\"],\n '1': [' |', ' |', ' |'],\n '2': ['.--.', ' --|', \"'--'\"],\n '3': ['.--.', ' --|', ' --\\''],\n '4': ['| |', \"'--|\", ' |'],\n '5': ['.--.', '|-- ', \" --'\"],\n '6': ['.--.', '|-- ', \"'--'\"],\n '7': ['.--.', ' |', ' |'],\n '8': ['.--.', '|--|', \"'--'\"],\n '9': ['.--.', \"'--|\", \" '\"],\n ':': [' ', '* ', '* '],\n '.': [' ', ' ', '* '],\n '%': ['|/ ', ' / ', '/ |'],\n ' ': [' ', ' ', ' '],\n};\n\nconst DIGIT_HEIGHT = 3;\nconst DIGIT_WIDTH = 4;\n\n/**\n * Digits — renders a numeric string as large 3-row ASCII art.\n * Similar to a 7-segment display. \n *\n * Example:\n * new Digits({ value: '42', color: 'cyan', width: 20, height: 3 })\n */\nexport class Digits extends Widget {\n private _value: string;\n private _color: Color;\n\n constructor(style: Partial<Style> = {}, opts: DigitsOptions = {}) {\n super({ height: DIGIT_HEIGHT, ...style });\n this._value = String((style as Record<string, unknown>).value ?? '0');\n this._color = opts.color ?? { type: 'named', name: 'white' };\n }\n\n setValue(value: string): void {\n if (this._value === value) return;\n this._value = value;\n this.markDirty();\n }\n\n getValue(): string {\n return this._value;\n }\n\n setColor(color: Color): void {\n if (this._color === color) return;\n this._color = color;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const fg = this._color;\n\n let curX = x;\n\n for (const ch of this._value) {\n const glyph = DIGIT_MAP[ch] ?? DIGIT_MAP[' ']!;\n const glyphWidth = DIGIT_WIDTH;\n\n if (curX + glyphWidth > x + width) break;\n\n for (let row = 0; row < DIGIT_HEIGHT && row < height; row++) {\n const rowStr = glyph[row] ?? '';\n for (let col = 0; col < rowStr.length; col++) {\n const char = rowStr[col];\n if (char !== ' ') {\n screen.setCell(curX + col, y + row, { char, ...attrs, fg });\n }\n }\n }\n\n // 1 column gap between digits\n curX += glyphWidth + 1;\n }\n }\n}\n","import { Widget } from '../base/Widget.js';\nimport { type Style, type Color, type Screen, caps, styleToCellAttrs, parseColor, stringWidth } from '@termuijs/core';\n\nexport interface LinkOptions {\n /** The target URL for the OSC 8 hyperlink anchor. */\n url: string;\n /** Underline and anchor fallback color object. Default: blue */\n color?: Color;\n /** Whether to append the URL visually when terminal capabilities lack unicode/OSC 8 support. Default: true */\n showUrlFallback?: boolean;\n}\n\nexport class Link extends Widget {\n private _text: string;\n private _url: string;\n private _color: Color;\n private _showUrlFallback: boolean;\n\n // Fixed constructor mapping: opts is now required to prevent missing URL type errors\n constructor(text: string, style: Partial<Style> | undefined, opts: LinkOptions) {\n super(style);\n \n this._text = text;\n this._url = opts.url;\n this._color = opts.color ?? parseColor('blue');\n this._showUrlFallback = opts.showUrlFallback ?? true;\n }\n\n public setText(text: string): void {\n if (this._text !== text) {\n this._text = text;\n this.markDirty();\n }\n }\n\n public setUrl(url: string): void {\n if (this._url !== url) {\n this._url = url;\n this.markDirty();\n }\n }\n\n /**\n * Helper to safely slice text based on its visible terminal cell width grid blocks\n */\n private _sliceByWidth(str: string, maxWidth: number): string {\n let currentWidth = 0;\n let result = '';\n for (const char of str) {\n const charWidth = stringWidth(char);\n if (currentWidth + charWidth > maxWidth) {\n break;\n }\n result += char;\n currentWidth += charWidth;\n }\n return result;\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n if (rect.width <= 0 || rect.height <= 0) {\n return;\n }\n\n let targetText = this._text;\n let cellLinkTarget: string | undefined = undefined;\n\n // 1. If terminal environment supports modern capabilities, set the metadata link directly\n if (caps.unicode) {\n cellLinkTarget = this._url;\n if (stringWidth(targetText) > rect.width) {\n targetText = this._sliceByWidth(targetText, rect.width);\n }\n } \n // 2. Fallback execution layout block for legacy or raw non-unicode terminal windows\n else if (this._showUrlFallback && this._url) {\n const fallbackSuffix = ` (${this._url})`;\n if (stringWidth(targetText + fallbackSuffix) > rect.width) {\n const availableWidthForText = rect.width - stringWidth(fallbackSuffix);\n targetText = availableWidthForText > 0 \n ? this._sliceByWidth(targetText, availableWidthForText) + fallbackSuffix\n : this._sliceByWidth(fallbackSuffix, rect.width);\n } else {\n targetText = targetText + fallbackSuffix;\n }\n } else {\n if (stringWidth(targetText) > rect.width) {\n targetText = this._sliceByWidth(targetText, rect.width);\n }\n }\n\n const cellAttrs = styleToCellAttrs({\n underline: true,\n fg: this._color,\n ...this.style,\n });\n\n // screen.writeString will map this property directly to cell.link without breaking string widths!\n screen.writeString(rect.x, rect.y, targetText, {\n ...cellAttrs,\n link: cellLinkTarget\n });\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ShortcutBar widget\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type KeyEvent,\n styleToCellAttrs,\n mergeStyles,\n stringWidth,\n truncate,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\n/**\n * Represents an individual shortcut item in the shortcut bar.\n */\nexport interface ShortcutItem {\n /** Keyboard key character/name (e.g. 'F1', 'q', 'ctrl+c') */\n key: string;\n /** Labeled explanation (e.g. 'Help', 'Quit') */\n label: string;\n /** Optional callback triggered on matching key press */\n action?: () => void;\n}\n\n/**\n * Options to configure styling and behavior of the ShortcutBar.\n */\nexport interface ShortcutBarOptions {\n /** Custom styles for the key (e.g., fg/bg colors). Default: cyan, bold */\n keyStyle?: Partial<Style>;\n /** Custom styles for the label text. Default: white */\n labelStyle?: Partial<Style>;\n /** Horizontal separator string. Default: ' ' (three spaces) */\n separator?: string;\n}\n\n/**\n * ShortcutBar — a horizontal footer bar that displays quick key bindings.\n * Matches design aesthetics of classic terminal tools (like nano, htop).\n */\nexport class ShortcutBar extends Widget {\n private _items: ShortcutItem[];\n private _keyStyle: Partial<Style>;\n private _labelStyle: Partial<Style>;\n private _separator: string;\n\n /**\n * Creates an instance of ShortcutBar.\n * @param items Initial list of shortcut items.\n * @param style Partial widget style object.\n * @param opts Custom options for key styling, label styling, and separator.\n */\n constructor(\n items: ShortcutItem[] = [],\n style: Partial<Style> = {},\n opts: ShortcutBarOptions = {},\n ) {\n super(style);\n this._items = items;\n this._keyStyle = opts.keyStyle ?? { fg: { type: 'named', name: 'cyan' }, bold: true };\n this._labelStyle = opts.labelStyle ?? { fg: { type: 'named', name: 'white' } };\n this._separator = opts.separator ?? ' ';\n this.focusable = false; // Usually not focused; key events are delegated or run globally\n }\n\n /**\n * Sets or replaces the current list of shortcut items.\n * @param items The new list of shortcut items.\n */\n setItems(items: ShortcutItem[]): void {\n if (\n this._items.length === items.length &&\n this._items.every(\n (item, index) =>\n item.key === items[index]?.key &&\n item.label === items[index]?.label &&\n item.action === items[index]?.action,\n )\n ) {\n return;\n }\n this._items = items;\n this.markDirty();\n }\n\n /**\n * Retrieves the current list of shortcut items.\n * @returns The list of shortcut items.\n */\n getItems(): ShortcutItem[] {\n return this._items;\n }\n\n /**\n * Updates the horizontal separator string printed between shortcut segments.\n * @param separator The new separator string.\n */\n setSeparator(separator: string): void {\n if (this._separator === separator) return;\n this._separator = separator;\n this.markDirty();\n }\n\n /**\n * Retrieves the current horizontal separator string.\n * @returns The separator string.\n */\n getSeparator(): string {\n return this._separator;\n }\n\n /**\n * Updates the custom styles applied to keys and label segments.\n * @param keyStyle Partial styling to apply to keys.\n * @param labelStyle Partial styling to apply to labels.\n */\n setStyles(keyStyle?: Partial<Style>, labelStyle?: Partial<Style>): void {\n if (keyStyle) this._keyStyle = keyStyle;\n if (labelStyle) this._labelStyle = labelStyle;\n this.markDirty();\n }\n\n /**\n * Handles keyboard keypress events. Triggers the action callback of the\n * shortcut item matching the pressed key (case-insensitively).\n * @param event The key event triggered by the user.\n */\n handleKey(event: KeyEvent): void {\n const matchingItem = this._items.find(\n item => item.key.toLowerCase() === event.key.toLowerCase(),\n );\n if (matchingItem && matchingItem.action) {\n matchingItem.action();\n }\n }\n\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const baseAttrs = styleToCellAttrs(this._style);\n const keyAttrs = styleToCellAttrs(mergeStyles(this._style, this._keyStyle));\n const labelAttrs = styleToCellAttrs(mergeStyles(this._style, this._labelStyle));\n\n let currentX = x;\n const separatorWidth = stringWidth(this._separator);\n\n for (let i = 0; i < this._items.length; i++) {\n const item = this._items[i];\n\n const keyText = `[${item.key}]`;\n const labelText = item.label;\n\n const keyLen = stringWidth(keyText);\n const labelLen = stringWidth(labelText);\n\n // Write separator if this is not the first item\n if (i > 0) {\n if (currentX + separatorWidth > x + width) break;\n screen.writeString(currentX, y, this._separator, baseAttrs);\n currentX += separatorWidth;\n }\n\n // Render key indicator (e.g. \"[F1]\")\n if (currentX + keyLen > x + width) break;\n screen.writeString(currentX, y, keyText, keyAttrs);\n currentX += keyLen;\n\n // Render label text (e.g. \" Help\")\n if (labelText) {\n if (currentX + 1 + labelLen > x + width) {\n const spaceLeft = x + width - currentX - 1;\n if (spaceLeft > 0) {\n screen.writeString(currentX, y, ' ', baseAttrs);\n currentX += 1;\n const truncatedLabel = truncate(labelText, spaceLeft);\n screen.writeString(currentX, y, truncatedLabel, labelAttrs);\n currentX += stringWidth(truncatedLabel);\n }\n break;\n } else {\n screen.writeString(currentX, y, ' ' + labelText, labelAttrs);\n currentX += 1 + labelLen;\n }\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Accordion widget\n//\n// A group of collapsible sections. By default only one\n// section can be open at a time. Set multiple: true to\n// allow several open sections simultaneously.\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type KeyEvent,\n styleToCellAttrs,\n truncate,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface AccordionSection {\n /** Section header title */\n title: string;\n /** Section body content (may contain newlines) */\n content: string;\n}\n\nexport interface AccordionOptions {\n /** Allow multiple sections open at once. Default: false */\n multiple?: boolean;\n /** Index of the initially open section. Default: 0 */\n openIndex?: number;\n /** Expand indicator char. Default: '▶' (or '>' in ASCII) */\n expandChar?: string;\n /** Collapse indicator char. Default: '▼' (or 'v' in ASCII) */\n collapseChar?: string;\n /** Callback fired when a section is toggled */\n onToggle?: (index: number, open: boolean) => void;\n}\n\n/**\n * Accordion — a group of collapsible sections.\n *\n * Renders each section as:\n * Row 0: [indicator] [title]\n * Rows 1+: content lines indented by 2 spaces (if section is open)\n *\n * Press Enter or Space to toggle the focused section.\n * Press up/down arrow keys to move between sections.\n *\n * @example\n * const accordion = new Accordion([\n * { title: 'System Info', content: 'CPU: 45%\\nRAM: 2.1 GB' },\n * { title: 'Network', content: 'eth0: 192.168.1.1' },\n * ]);\n */\nexport class Accordion extends Widget {\n private _sections: AccordionSection[];\n private _openSet: Set<number>;\n private _multiple: boolean;\n private _expandChar: string;\n private _collapseChar: string;\n private _onToggle?: (index: number, open: boolean) => void;\n private _focusedIndex: number = 0;\n\n constructor(\n sections: AccordionSection[],\n style: Partial<Style> = {},\n opts: AccordionOptions = {},\n ) {\n super(style);\n this.focusable = true;\n\n this._sections = sections;\n this._multiple = opts.multiple ?? false;\n this._expandChar = opts.expandChar ?? (caps.unicode ? '▶' : '>');\n this._collapseChar = opts.collapseChar ?? (caps.unicode ? '▼' : 'v');\n this._onToggle = opts.onToggle;\n\n // Initialise open set\n this._openSet = new Set();\n if (sections.length > 0) {\n const idx = opts.openIndex ?? 0;\n if (idx >= 0 && idx < sections.length) {\n this._openSet.add(idx);\n }\n }\n\n this._updateHeight();\n }\n\n // ── Public API ──────────────────────────────────────────────────────\n\n /** Open a section by index. No-op if already open or index out of bounds. */\n open(index: number): void {\n if (index < 0 || index >= this._sections.length) return;\n if (this._openSet.has(index)) return;\n if (!this._multiple) {\n // Fire onToggle for all sections being implicitly closed\n for (const idx of this._openSet) {\n this._onToggle?.(idx, false);\n }\n this._openSet.clear();\n }\n this._openSet.add(index);\n this._updateHeight();\n this._onToggle?.(index, true);\n this.markDirty();\n }\n\n /** Close a section by index. No-op if already closed. */\n close(index: number): void {\n if (!this._openSet.has(index)) return;\n this._openSet.delete(index);\n this._updateHeight();\n this._onToggle?.(index, false);\n this.markDirty();\n }\n\n /** Toggle a section open or closed by index. */\n toggle(index: number): void {\n if (this._openSet.has(index)) {\n this.close(index);\n } else {\n this.open(index);\n }\n }\n\n /** Returns true if the section at the given index is open. */\n isOpen(index: number): boolean {\n return this._openSet.has(index);\n }\n\n /** Returns the index of the currently keyboard-focused section. */\n getFocusedIndex(): number {\n return this._focusedIndex;\n }\n\n /** Replace all sections and reset open/focus state. */\n setSections(sections: AccordionSection[]): void {\n this._sections = sections;\n this._openSet.clear();\n if (sections.length > 0) this._openSet.add(0);\n this._focusedIndex = 0;\n this._updateHeight();\n this.markDirty();\n }\n\n // ── Keyboard ────────────────────────────────────────────────────────\n\n /**\n * Handle a key event. Call this from your app's key-routing logic\n * when this widget is focused.\n */\n handleKey(event: KeyEvent): void {\n switch (event.key.toLowerCase()) {\n case 'enter':\n case ' ':\n case 'space':\n this.toggle(this._focusedIndex);\n break;\n case 'arrowup':\n case 'up':\n if (this._focusedIndex > 0) {\n this._focusedIndex--;\n this.markDirty();\n }\n break;\n case 'arrowdown':\n case 'down':\n if (this._focusedIndex < this._sections.length - 1) {\n this._focusedIndex++;\n this.markDirty();\n }\n break;\n }\n }\n\n // ── Render ──────────────────────────────────────────────────────────\n\n /** Render all sections with their open/closed state. */\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n let row = 0;\n\n for (let i = 0; i < this._sections.length; i++) {\n if (row >= height) break;\n\n const section = this._sections[i];\n const open = this._openSet.has(i);\n const focused = i === this._focusedIndex;\n\n // Title row\n const indicator = open ? this._collapseChar : this._expandChar;\n const titleLine = indicator + ' ' + section.title;\n const titleAttrs = focused\n ? { ...attrs, bold: true }\n : attrs;\n screen.writeString(x, y + row, truncate(titleLine, width), titleAttrs);\n row++;\n\n // Content rows (if open)\n if (open) {\n const lines = section.content.split('\\n');\n for (const line of lines) {\n if (row >= height) break;\n screen.writeString(\n x,\n y + row,\n truncate(' ' + line, width),\n attrs,\n );\n row++;\n }\n }\n }\n }\n\n // ── Private ─────────────────────────────────────────────────────────\n\n /** Recalculate total height based on open sections. */\n private _updateHeight(): void {\n let total = this._sections.length; // one title row per section\n for (let i = 0; i < this._sections.length; i++) {\n if (this._openSet.has(i)) {\n total += this._sections[i].content.split('\\n').length;\n }\n }\n this._style.height = total;\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Stepper widget\n// Renders sequential step progress with status indicators\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type Color,\n styleToCellAttrs,\n stringWidth,\n truncate,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type StepStatus = 'completed' | 'active' | 'pending';\nexport type StepperOrientation = 'horizontal' | 'vertical';\n\nexport interface StepperStep {\n /** Step label */\n label: string;\n /** Step status. Default: 'pending' */\n status?: StepStatus;\n}\n\nexport interface StepperOptions {\n /** Layout direction. Default: 'horizontal' */\n orientation?: StepperOrientation;\n /** Color for active step. Default: cyan */\n activeColor?: Color;\n /** Color for completed step. Default: green */\n completedColor?: Color;\n /** Color for pending step. Default: white */\n pendingColor?: Color;\n}\n\n/**\n * Stepper — renders a sequence of steps with status indicators.\n *\n * Horizontal example:\n * ✓ Setup ──── ● Config ──── ○ Review ──── ○ Done\n *\n * Vertical example:\n * ✓ Setup\n * │\n * ● Config\n * │\n * ○ Review\n *\n * Icons: ✓/+ (completed), ●/* (active), ○/- (pending)\n * Unicode fallback via caps.unicode.\n */\nexport class Stepper extends Widget {\n private _steps: StepperStep[];\n private _orientation: StepperOrientation;\n private _activeColor: Color;\n private _completedColor: Color;\n private _pendingColor: Color;\n\n constructor(\n steps: StepperStep[],\n style: Partial<Style> = {},\n opts: StepperOptions = {},\n ) {\n super(style);\n // Clone steps to prevent external mutation bypassing markDirty()\n this._steps = steps.map(s => ({ ...s }));\n this._orientation = opts.orientation ?? 'horizontal';\n this._activeColor = opts.activeColor ?? { type: 'named', name: 'cyan' };\n this._completedColor = opts.completedColor ?? { type: 'named', name: 'green' };\n this._pendingColor = opts.pendingColor ?? { type: 'named', name: 'white' };\n }\n\n // ── Public API ──────────────────────────────────────────────────────\n\n /** Replace all steps. Clones input to prevent external mutation. */\n setSteps(steps: StepperStep[]): void {\n this._steps = steps.map(s => ({ ...s }));\n this.markDirty();\n }\n\n /** Get current steps. Returns copies to prevent external mutation. */\n getSteps(): StepperStep[] {\n return this._steps.map(s => ({ ...s }));\n }\n\n /** Update the status of a single step by index. */\n setStepStatus(index: number, status: StepStatus): void {\n if (index < 0 || index >= this._steps.length) return;\n this._steps[index].status = status;\n this.markDirty();\n }\n\n /** Advance the active step to the next one. */\n nextStep(): void {\n const activeIdx = this._steps.findIndex(s => s.status === 'active');\n if (activeIdx === -1 || activeIdx >= this._steps.length - 1) return;\n this._steps[activeIdx].status = 'completed';\n this._steps[activeIdx + 1].status = 'active';\n this.markDirty();\n }\n\n /** Move the active step to the previous one. */\n prevStep(): void {\n const activeIdx = this._steps.findIndex(s => s.status === 'active');\n if (activeIdx <= 0) return;\n this._steps[activeIdx].status = 'pending';\n this._steps[activeIdx - 1].status = 'active';\n this.markDirty();\n }\n\n // ── Render ──────────────────────────────────────────────────────────\n\n /** Render all steps with connectors and status icons. */\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._steps.length === 0) return;\n\n if (this._orientation === 'horizontal') {\n this._renderHorizontal(screen, x, y, width);\n } else {\n this._renderVertical(screen, x, y, width, height);\n }\n }\n\n // ── Private ─────────────────────────────────────────────────────────\n\n /** Render steps left-to-right on a single row. */\n private _renderHorizontal(\n screen: Screen,\n x: number,\n y: number,\n width: number,\n ): void {\n const attrs = styleToCellAttrs(this._style);\n const connector = caps.unicode ? '────' : '----';\n let cursorX = x;\n\n for (let i = 0; i < this._steps.length; i++) {\n if (cursorX >= x + width) break;\n const step = this._steps[i];\n const status = step.status ?? 'pending';\n const { icon, color, bold, dim } = this._stepStyle(status);\n\n // Icon\n screen.setCell(cursorX, y, { char: icon, fg: color, bold, dim });\n cursorX++;\n\n // Space + label\n const labelStr = ' ' + step.label;\n const labelWidth = stringWidth(labelStr);\n if (cursorX + labelWidth > x + width) break;\n screen.writeString(cursorX, y, labelStr, { ...attrs, fg: color, bold, dim });\n cursorX += labelWidth;\n\n // Connector between steps (not after last)\n if (i < this._steps.length - 1) {\n const connWidth = stringWidth(connector);\n if (cursorX + connWidth > x + width) break;\n screen.writeString(cursorX, y, connector, {\n ...attrs,\n fg: { type: 'named', name: 'brightBlack' },\n });\n cursorX += connWidth;\n }\n }\n }\n\n /** Render steps top-to-bottom with vertical connectors. */\n private _renderVertical(\n screen: Screen,\n x: number,\n y: number,\n width: number,\n height: number,\n ): void {\n const attrs = styleToCellAttrs(this._style);\n const connectorChar = caps.unicode ? '│' : '|';\n let row = 0;\n\n for (let i = 0; i < this._steps.length; i++) {\n if (row >= height) break;\n const step = this._steps[i];\n const status = step.status ?? 'pending';\n const { icon, color, bold, dim } = this._stepStyle(status);\n\n // Icon + label row — use truncate for correct terminal cell width clipping\n const line = icon + ' ' + step.label;\n screen.writeString(x, y + row, truncate(line, width), {\n ...attrs,\n fg: color,\n bold,\n dim,\n });\n row++;\n\n // Connector row between steps (not after last)\n if (i < this._steps.length - 1 && row < height) {\n screen.setCell(x, y + row, {\n char: connectorChar,\n fg: { type: 'named', name: 'brightBlack' },\n });\n row++;\n }\n }\n }\n\n /** Returns the icon, color, and text attributes for a given status. */\n private _stepStyle(status: StepStatus): {\n icon: string;\n color: Color;\n bold: boolean;\n dim: boolean;\n } {\n switch (status) {\n case 'completed':\n return {\n icon: caps.unicode ? '✓' : '+',\n color: this._completedColor,\n bold: false,\n dim: false,\n };\n case 'active':\n return {\n icon: caps.unicode ? '●' : '*',\n color: this._activeColor,\n bold: true,\n dim: false,\n };\n default:\n return {\n icon: caps.unicode ? '○' : '-',\n color: this._pendingColor,\n bold: false,\n dim: true,\n };\n }\n }\n}","import { Widget } from '../base/Widget.js';\nimport { type Screen, type Style, caps, styleToCellAttrs } from '@termuijs/core';\n\nexport interface QRCodePatternOptions {\n darkChar?: string;\n lightChar?: string;\n showText?: boolean;\n}\n\nexport interface QRCodeOptions extends QRCodePatternOptions {\n errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';\n}\n\nconst SIZE = 21;\n\n/**\n * Decorative QR-style pattern generator.\n * This widget is intentionally not a scannable QR code.\n */\nfunction hashString(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash * 31 + str.charCodeAt(i)) >>> 0;\n }\n return hash;\n}\n\nexport class QRCodePattern extends Widget {\n private data: string;\n private opts: QRCodePatternOptions;\n\n constructor(data: string, style?: Partial<Style>, opts?: QRCodePatternOptions) {\n super(style);\n this.data = data;\n this.opts = opts ?? {};\n }\n\n setData(data: string): void {\n if(this.data === data) return;\n this.data = data;\n this.markDirty();\n }\n\n private isFinder(x: number, y: number): boolean {\n const inTopLeft = x < 7 && y < 7;\n const inTopRight = x > SIZE - 8 && y < 7;\n const inBottomLeft = x < 7 && y > SIZE - 8;\n\n return inTopLeft || inTopRight || inBottomLeft;\n }\n\n private renderFinder(x: number, y: number): string {\n const dark = caps.unicode ? (this.opts.darkChar ?? '█') : '#';\n const light = caps.unicode ? (this.opts.lightChar ?? ' ') : ' ';\n\n const dx = x % 7;\n const dy = y % 7;\n\n const border = dx === 0 || dx === 6 || dy === 0 || dy === 6;\n const center = dx >= 2 && dx <= 4 && dy >= 2 && dy <= 4;\n\n return border || center ? dark : light;\n }\n\n protected _renderSelf(screen: Screen): void {\n const contentRect = this._getContentRect();\n const { x: baseX, y: baseY, width, height } = contentRect;\n if (width <= 0 || height <= 0) return;\n\n const dark = caps.unicode ? (this.opts.darkChar ?? '█') : '#';\n const light = caps.unicode ? (this.opts.lightChar ?? ' ') : ' ';\n const attrs = styleToCellAttrs(this._style);\n const hash = hashString(this.data);\n\n const drawWidth = Math.min(SIZE, width);\n const drawHeight = Math.min(SIZE, height);\n\n for (let row = 0; row < drawHeight; row++) {\n for (let col = 0; col < drawWidth; col++) {\n let char: string;\n \n if (this.isFinder(col, row)) {\n char = this.renderFinder(col, row);\n } else {\n const bitIndex = (col * row + hash) % 32;\n const bit = (hash >> bitIndex) & 1;\n char = bit ? dark : light;\n }\n \n screen.writeString(baseX + col, baseY + row, char, attrs);\n }\n }\n \n if (this.opts.showText && height > drawHeight) {\n screen.writeString(\n baseX,\n baseY + drawHeight,\n this.data.slice(0, width),\n attrs\n );\n }\n }\n}\n\n\nexport const QRCode = QRCodePattern;","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Stack layout widget\n// Layers children on top of each other (Z-axis stacking)\n// ─────────────────────────────────────────────────────\n\nimport type { Screen, Style } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface StackOptions {\n /** Which child is on top (receives key events). Default: last child */\n activeIndex?: number;\n}\n\n/**\n * Stack — a widget that layers children on top of each other.\n *\n * All children share the same rect (the Stack's bounds).\n * Children render in array order: index 0 is bottom, last index is top.\n */\nexport class Stack extends Widget {\n private _activeIndex: number;\n\n constructor(children: Widget[], style?: Partial<Style>, opts?: StackOptions) {\n super(style);\n this._activeIndex = opts?.activeIndex ?? (children.length > 0 ? children.length - 1 : 0);\n \n // Add all children\n for (const child of children) {\n this.addChild(child);\n }\n }\n\n /**\n * Replace all children with a new array.\n */\n setChildren(children: Widget[]): void {\n // Remove existing children\n while (this._children.length > 0) {\n const child = this._children[0];\n this.removeChild(child);\n }\n \n // Add new children\n for (const child of children) {\n this.addChild(child);\n }\n \n // Ensure activeIndex is valid\n if (this._activeIndex >= this._children.length) {\n this._activeIndex = this._children.length > 0 ? this._children.length - 1 : 0;\n }\n \n this.markDirty();\n }\n\n /**\n * Set which child is active (on top).\n */\n setActiveIndex(index: number): void {\n if (index >= 0 && index < this._children.length && index !== this._activeIndex) {\n this._activeIndex = index;\n this.markDirty();\n }\n }\n\n /**\n * Get the currently active child index.\n */\n getActiveIndex(): number {\n return this._activeIndex;\n }\n\n /**\n * Required abstract method implementation.\n * Stack is a pure layout container — no self-rendering needed.\n */\n protected _renderSelf(_screen: Screen): void {\n // Stack is a pure layout container - no self-rendering needed\n }\n}\n","import { Widget } from '../base/Widget.js';\nimport { type Style, type Color, Screen, caps } from '@termuijs/core';\n\nexport interface ScatterPoint {\n x: number;\n y: number;\n color?: Color;\n}\n\nexport interface ScatterPlotOptions {\n /** X axis label */\n xLabel?: string;\n /** Y axis label */\n yLabel?: string;\n /** Point marker. Default: '•' with ASCII fallback '.' */\n marker?: string;\n pointColor?: Color;\n}\n\nexport class ScatterPlot extends Widget {\n private points: ScatterPoint[] = [];\n private options: ScatterPlotOptions;\n\n constructor(style?: Partial<Style>, opts?: ScatterPlotOptions) {\n super(style);\n this.options = opts || {};\n }\n\n setData(points: ScatterPoint[]): void {\n this.points = points;\n this.markDirty();\n }\n\n protected override _renderSelf(screen: Screen): void {\n if (!this.rect) return;\n\n const { x, y, width, height } = this.rect;\n if (width < 2 || height < 2) return;\n\n const isUnicode = caps.unicode;\n const vLine = isUnicode ? '│' : '|';\n const hLine = isUnicode ? '─' : '-';\n const corner = isUnicode ? '└' : '+';\n\n const plotX = x + 1;\n const plotY = y;\n const plotW = width - 1;\n const plotH = height - 1;\n const originY = y + height - 1;\n\n // Render Y-Axis\n for (let i = plotY; i < originY; i++) {\n screen.writeString(x, i, vLine, { fg: this.options.pointColor });\n }\n\n // Render X-Axis\n for (let i = plotX; i < x + width; i++) {\n screen.writeString(i, originY, hLine, { fg: this.options.pointColor });\n }\n\n // Render Origin Corner\n screen.writeString(x, originY, corner, { fg: this.options.pointColor });\n\n // Render Labels\n if (this.options.yLabel) {\n screen.writeString(x + 1, y, this.options.yLabel);\n }\n if (this.options.xLabel) {\n const xL = this.options.xLabel;\n const startX = Math.max(plotX, x + width - xL.length);\n screen.writeString(startX, originY, xL);\n }\n\n // Plot Points\n if (this.points.length === 0) return;\n\n let minX = Infinity, maxX = -Infinity;\n let minY = Infinity, maxY = -Infinity;\n\n for (const p of this.points) {\n if (p.x < minX) minX = p.x;\n if (p.x > maxX) maxX = p.x;\n if (p.y < minY) minY = p.y;\n if (p.y > maxY) maxY = p.y;\n }\n\n // Prevent division by zero if all points have the same coordinate\n if (minX === maxX) { minX -= 1; maxX += 1; }\n if (minY === maxY) { minY -= 1; maxY += 1; }\n\n const marker = this.options.marker ?? (isUnicode ? '•' : '.');\n\n for (const p of this.points) {\n const normalizedX = (p.x - minX) / (maxX - minX);\n const normalizedY = (p.y - minY) / (maxY - minY);\n\n const px = Math.floor(plotX + normalizedX * (plotW - 1));\n const py = Math.floor(originY - 1 - normalizedY * (plotH - 1));\n\n // Ensure points remain inside drawing bounds\n if (px >= plotX && px < x + width && py >= plotY && py < originY) {\n screen.writeString(px, py, marker, { fg: p.color || this.options.pointColor });\n }\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — RadarChart (Self-Contained)\n// ─────────────────────────────────────────────────────\n\nimport { Widget } from '../base/Widget.js';\nimport { type Style, type Color, Screen } from '@termuijs/core';\n\nexport interface RadarSeries {\n label: string;\n /** One value per axis, range [0, 1] */\n values: number[];\n color?: Color;\n}\n\nexport interface RadarChartOptions {\n /** Axis names, one per spoke */\n axes?: string[];\n lineColor?: Color;\n}\n\nexport class RadarChart extends Widget {\n private series: RadarSeries[] = [];\n private options: RadarChartOptions;\n\n constructor(style?: Partial<Style>, opts?: RadarChartOptions) {\n super(style);\n this.options = opts || {};\n }\n\n setSeries(series: RadarSeries[]): void {\n this.series = series;\n this.markDirty();\n }\n\n protected override _renderSelf(screen: Screen): void {\n if (!this.rect || this.series.length === 0) return;\n\n const { x, y, width, height } = this.rect;\n const cx = Math.floor(x + width / 2);\n const cy = Math.floor(y + height / 2);\n // Standard radius calculation\n const maxR = Math.min(width / 2, height / 2) - 1; \n\n if (maxR <= 0) return;\n\n for (const s of this.series) {\n const numAxes = s.values.length;\n if (numAxes === 0) continue;\n \n const points = s.values.map((val, i) => {\n const theta = -Math.PI / 2 + (i * 2 * Math.PI) / numAxes;\n const clampedVal = Math.max(0, Math.min(1, val));\n return {\n // Multiply X by 2 to compensate for tall terminal character aspect ratio\n px: Math.floor(cx + clampedVal * maxR * Math.cos(theta) * 2),\n py: Math.floor(cy + clampedVal * maxR * Math.sin(theta))\n };\n });\n\n // Connect the points using Bresenham's line algorithm directly on the screen\n for (let i = 0; i < points.length; i++) {\n const p1 = points[i];\n const p2 = points[(i + 1) % points.length];\n this.drawLine(screen, p1.px, p1.py, p2.px, p2.py, s.color || this.options.lineColor);\n }\n }\n\n this.renderLabels(screen, x, y, width, height);\n }\n\n private drawLine(screen: Screen, x0: number, y0: number, x1: number, y1: number, color?: Color) {\n let dx = Math.abs(x1 - x0);\n let dy = Math.abs(y1 - y0);\n let sx = x0 < x1 ? 1 : -1;\n let sy = y0 < y1 ? 1 : -1;\n let err = dx - dy;\n\n while (true) {\n screen.writeString(x0, y0, '*', { fg: color });\n if (x0 === x1 && y0 === y1) break;\n let e2 = 2 * err;\n if (e2 > -dy) { err -= dy; x0 += sx; }\n if (e2 < dx) { err += dx; y0 += sy; }\n }\n }\n\n private renderLabels(screen: Screen, x: number, y: number, width: number, height: number) {\n if (!this.options.axes || this.series.length === 0) return;\n \n const numAxes = this.options.axes.length;\n const cx = Math.floor(x + width / 2);\n const cy = Math.floor(y + height / 2);\n const maxR = Math.min(width / 2, height / 2) - 1;\n\n for (let i = 0; i < numAxes; i++) {\n const label = this.options.axes[i];\n if (!label) continue;\n \n const theta = -Math.PI / 2 + (i * 2 * Math.PI) / numAxes;\n const lx = Math.floor(cx + maxR * Math.cos(theta) * 2.2); \n const ly = Math.floor(cy + maxR * Math.sin(theta) * 1.2);\n \n // Clamp the X coordinate to prevent horizontal clipping\n const rawX = lx - Math.floor(label.length / 2);\n const startX = Math.max(x, Math.min(x + width - label.length, rawX));\n \n // Clamp the Y coordinate to prevent vertical clipping (fixes \"Speed\" disappearing)\n const startY = Math.max(y, Math.min(y + height - 1, ly));\n \n screen.writeString(startX, startY, label);\n }\n }\n}","import { type Screen, type Style, type Color, styleToCellAttrs, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface StatOptions {\n delta?: number;\n valueColor?: Color;\n}\n\nexport class Stat extends Widget {\n private _label: string;\n private _value: string;\n private _delta: number | undefined;\n private _valueColor: Color;\n\n constructor(label: string, value: string, style: Partial<Style> = {}, opts: StatOptions = {}) {\n super(style);\n this._label = label;\n this._value = value;\n this._delta = opts.delta;\n this._valueColor = opts.valueColor ?? { type: 'named', name: 'white' };\n }\n\n setValue(value: string): void {\n this._value = value;\n this.markDirty();\n }\n\n setDelta(delta: number | undefined): void {\n this._delta = delta;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n // Row 0: label (bold)\n screen.writeString(x, y, this._label, { ...attrs, bold: true });\n\n if (height < 2) return;\n\n // Row 1: value\n screen.writeString(x, y + 1, this._value, { ...attrs, fg: this._valueColor });\n\n // Optional delta arrow\n if (this._delta !== undefined) {\n const valueWidth = stringWidth(this._value);\n const arrowX = x + valueWidth + 1;\n\n if (arrowX >= x + width) return;\n\n if (this._delta > 0) {\n screen.setCell(arrowX, y + 1, { char: '\\u2191', fg: { type: 'named', name: 'green' } });\n } else if (this._delta < 0) {\n screen.setCell(arrowX, y + 1, { char: '\\u2193', fg: { type: 'named', name: 'red' } });\n } else {\n screen.setCell(arrowX, y + 1, { char: '\\u2192', dim: true });\n }\n }\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — CandlestickChart widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface Candle {\n open: number;\n high: number;\n low: number;\n close: number;\n}\n\nexport interface CandlestickChartOptions {\n /** Color for bullish (close > open) candles */\n upColor?: Color;\n /** Color for bearish (close < open) candles */\n downColor?: Color;\n /** Color for the wick (high/low lines) */\n wickColor?: Color;\n}\n\nconst DEFAULT_UP_COLOR: Color = { type: 'named', name: 'green' };\nconst DEFAULT_DOWN_COLOR: Color = { type: 'named', name: 'red' };\n\n/**\n * CandlestickChart — renders OHLC candle data as a terminal chart.\n *\n * Each candle occupies one column. The body shows open/close range,\n * wicks extend to high/low. Bullish candles use upColor, bearish use downColor.\n */\nexport class CandlestickChart extends Widget {\n private _candles: Candle[] = [];\n private _upColor: Color;\n private _downColor: Color;\n private _wickColor: Color | undefined;\n\n constructor(style?: Partial<Style>, opts?: CandlestickChartOptions) {\n super(style);\n this._upColor = opts?.upColor ?? DEFAULT_UP_COLOR;\n this._downColor = opts?.downColor ?? DEFAULT_DOWN_COLOR;\n this._wickColor = opts?.wickColor;\n }\n\n setData(candles: Candle[]): void {\n this._candles = candles;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n if (this._candles.length === 0) return;\n\n const rect = this._getContentRect();\n const { x: startX, y: startY, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n const candleCount = Math.min(this._candles.length, width);\n const visibleCandles = this._candles.slice(0, candleCount);\n\n let maxHigh = 0;\n let minLow = 0;\n if (visibleCandles.length > 0) {\n maxHigh = Math.max(...visibleCandles.map(c => c.high));\n minLow = Math.min(...visibleCandles.map(c => c.low));\n }\n\n const priceRange = maxHigh - minLow || 1;\n\n for (let i = 0; i < candleCount; i++) {\n const candle = this._candles[i];\n const colX = startX + i;\n\n const mapY = (val: number): number => {\n const ratio = (val - minLow) / priceRange;\n return Math.round(startY + height - 1 - ratio * (height - 1));\n };\n\n const highY = mapY(candle.high);\n const lowY = mapY(candle.low);\n const openY = mapY(candle.open);\n const closeY = mapY(candle.close);\n\n const bodyTop = Math.min(openY, closeY);\n const bodyBottom = Math.max(openY, closeY);\n\n const isBullish = candle.close > candle.open;\n const bodyColor = isBullish ? this._upColor : this._downColor;\n const wickColor = this._wickColor ?? bodyColor;\n\n const wickChar = '|';\n const bodyChar = caps.unicode ? '┃' : '=';\n\n for (let rowY = Math.min(highY, lowY); rowY <= Math.max(highY, lowY); rowY++) {\n if (rowY >= bodyTop && rowY <= bodyBottom) {\n screen.setCell(colX, rowY, { char: bodyChar, ...attrs, fg: bodyColor });\n } else {\n screen.setCell(colX, rowY, { char: wickChar, ...attrs, fg: wickColor });\n }\n }\n }\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Timer widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface TimerOptions {\n /** Duration to count down from in milliseconds. */\n duration: number;\n /** Tick interval in milliseconds. Default: 1000. */\n interval?: number;\n}\n\n/**\n * Timer — counts down from a duration to zero.\n *\n * - Accepts `duration` in milliseconds.\n * - Exposes `start()`, `stop()`, and `reset()` methods.\n * - Fires `onComplete()` callback when it reaches zero.\n * - Renders as `MM:SS` for durations < 1 hour, `HH:MM:SS` for longer.\n * - Calls `this.markDirty()` on every tick so the render loop re-paints.\n * - Clears the interval on `stop()` and in `destroy()` to prevent leaks.\n */\nexport class Timer extends Widget {\n /** Duration to count down from (ms). */\n private _duration: number;\n\n /** Tick interval in ms (default 1000). */\n private _interval: number;\n\n /** Remaining time in ms. */\n private _remaining: number;\n\n /** Whether the timer is currently running. */\n private _running = false;\n\n /** Internal setInterval handle. */\n private _intervalId: ReturnType<typeof setInterval> | undefined;\n\n /**\n * Called when the countdown reaches zero.\n * Assign a function to this property to receive the event.\n *\n * @example\n * timer.onComplete = () => {};\n */\n onComplete: (() => void) | undefined;\n\n constructor(options: TimerOptions, style: Partial<Style> = {}) {\n super({ height: 1, ...style });\n this._duration = options.duration;\n this._interval = options.interval ?? 1000;\n this._remaining = options.duration;\n }\n\n // ── Public API ──────────────────────────────────────────────────────\n\n /** Start (or resume) the countdown. No-op if already running. */\n start(): void {\n if (this._running) return;\n if (this._remaining <= 0) return; // Already completed\n this._running = true;\n this._intervalId = setInterval(() => this._tick(), this._interval);\n }\n\n /** Pause the countdown. No-op if already stopped. */\n stop(): void {\n if (!this._running) return;\n this._running = false;\n this._clearInterval();\n }\n\n /**\n * Reset the remaining time back to the original duration and stop any\n * running countdown.\n */\n reset(): void {\n const wasRunning = this._running;\n \n this.stop();\n \n if (!wasRunning && this._remaining === this._duration) {\n return;\n }\n \n this._remaining = this._duration;\n this.markDirty();\n }\n\n /** Returns `true` when the countdown has reached zero. */\n isComplete(): boolean {\n return this._remaining <= 0;\n }\n\n /** Returns the remaining time in milliseconds. */\n getRemaining(): number {\n return this._remaining;\n }\n\n /**\n * Release all resources held by this widget.\n * Call this when the widget is no longer needed to avoid timer leaks.\n */\n destroy(): void {\n this.stop();\n this._clearInterval();\n }\n\n // ── Lifecycle ───────────────────────────────────────────────────────\n\n /** Stop the interval when the widget is unmounted. */\n unmount(): void {\n this._clearInterval();\n super.unmount();\n }\n\n // ── Internal ────────────────────────────────────────────────────────\n\n /** Called on each interval tick. */\n private _tick(): void {\n this._remaining = Math.max(0, this._remaining - this._interval);\n this.markDirty();\n\n if (this._remaining <= 0) {\n this._running = false;\n this._clearInterval();\n this.onComplete?.();\n }\n }\n\n /** Safely clear the internal interval. */\n private _clearInterval(): void {\n if (this._intervalId !== undefined) {\n clearInterval(this._intervalId);\n this._intervalId = undefined;\n }\n }\n\n // ── Formatting ──────────────────────────────────────────────────────\n\n /**\n * Format milliseconds as `MM:SS` or `HH:MM:SS`.\n *\n * Chooses `HH:MM:SS` when the original duration is >= 1 hour (3600000 ms).\n */\n private _format(ms: number): string {\n const totalSeconds = Math.ceil(ms / 1000);\n const hours = Math.floor(totalSeconds / 3600);\n const seconds = totalSeconds % 60;\n\n const ss = String(seconds).padStart(2, '0');\n\n if (this._duration >= 3_600_000) {\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const hh = String(hours).padStart(2, '0');\n const mm = String(minutes).padStart(2, '0');\n return `${hh}:${mm}:${ss}`;\n }\n\n // MM:SS branch: use total minutes (not modulo 3600) to avoid wrapping\n // when Math.ceil rounds up to exactly 3600 s on a sub-hour timer.\n const minutes = Math.floor(totalSeconds / 60);\n const mm = String(minutes).padStart(2, '0');\n return `${mm}:${ss}`;\n }\n\n // ── Rendering ───────────────────────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const label = this._format(this._remaining);\n\n screen.writeString(x, y, label, attrs);\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Stopwatch widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface StopwatchOptions {\n /** Tick interval in milliseconds. Default: 10 (for centisecond precision). */\n interval?: number;\n}\n\n/**\n * Stopwatch — counts up from zero, displaying elapsed time.\n *\n * - Exposes `start()`, `stop()`, and `reset()` methods.\n * - Renders elapsed time as `MM:SS.ms` (e.g. `01:23.45`).\n * - Calls `this.markDirty()` on every tick so the render loop re-paints.\n * - Clears the interval on `stop()` and in `destroy()` to prevent leaks.\n */\nexport class Stopwatch extends Widget {\n /** Accumulated elapsed time in ms (from prior start/stop cycles). */\n private _elapsed = 0;\n\n /** Timestamp (Date.now()) when the current run started, or undefined if stopped. */\n private _startTime: number | undefined;\n\n /** Tick interval in ms (default 10). */\n private _interval: number;\n\n /** Whether the stopwatch is currently running. */\n private _running = false;\n\n /** Internal setInterval handle. */\n private _intervalId: ReturnType<typeof setInterval> | undefined;\n\n constructor(options: StopwatchOptions = {}, style: Partial<Style> = {}) {\n super({ height: 1, ...style });\n this._interval = options.interval ?? 10;\n }\n\n // ── Public API ──────────────────────────────────────────────────────\n\n /** Start (or resume) the stopwatch. No-op if already running. */\n start(): void {\n if (this._running) return;\n this._running = true;\n this._startTime = Date.now();\n this._intervalId = setInterval(() => this._tick(), this._interval);\n }\n\n /** Pause the stopwatch. No-op if already stopped. */\n stop(): void {\n if (!this._running) return;\n // Accumulate the elapsed time from the current run before stopping.\n if (this._startTime !== undefined) {\n this._elapsed += Date.now() - this._startTime;\n this._startTime = undefined;\n }\n this._running = false;\n this._clearInterval();\n this.markDirty();\n }\n\n /** Reset elapsed time to zero and stop the stopwatch. */\n reset(): void {\n this.stop();\n this._elapsed = 0;\n this._startTime = undefined;\n this.markDirty();\n }\n\n /** Returns the total elapsed milliseconds (including current run). */\n getElapsed(): number {\n if (this._running && this._startTime !== undefined) {\n return this._elapsed + (Date.now() - this._startTime);\n }\n return this._elapsed;\n }\n\n /** Returns `true` when the stopwatch is currently running. */\n isRunning(): boolean {\n return this._running;\n }\n\n /**\n * Release all resources held by this widget.\n * Call this when the widget is no longer needed to avoid timer leaks.\n */\n destroy(): void {\n this.stop();\n this._clearInterval();\n }\n\n // ── Lifecycle ───────────────────────────────────────────────────────\n\n /** Stop the interval when the widget is unmounted. */\n unmount(): void {\n this._clearInterval();\n super.unmount();\n }\n\n // ── Internal ────────────────────────────────────────────────────────\n\n /** Called on each interval tick. */\n private _tick(): void {\n this.markDirty();\n }\n\n /** Safely clear the internal interval. */\n private _clearInterval(): void {\n if (this._intervalId !== undefined) {\n clearInterval(this._intervalId);\n this._intervalId = undefined;\n }\n }\n\n // ── Formatting ──────────────────────────────────────────────────────\n\n /**\n * Format milliseconds as `MM:SS.ms`.\n *\n * The `.ms` portion shows centiseconds (hundredths of a second).\n * Example: 75423 ms → `01:15.42`\n */\n private _format(ms: number): string {\n const totalCs = Math.floor(ms / 10); // centiseconds\n const cs = totalCs % 100;\n const totalSeconds = Math.floor(totalCs / 100);\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n\n const mm = String(minutes).padStart(2, '0');\n const ss = String(seconds).padStart(2, '0');\n const msStr = String(cs).padStart(2, '0');\n\n return `${mm}:${ss}.${msStr}`;\n }\n\n // ── Rendering ───────────────────────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width } = rect;\n if (width <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const label = this._format(this.getElapsed());\n\n screen.writeString(x, y, label, attrs);\n }\n\n setInterval(interval: number): void {\n if (interval === this._interval) return;\n \n this._interval = interval;\n \n if (this._running) {\n this._clearInterval();\n this._intervalId = setInterval(() => this._tick(), this._interval);\n }\n \n this.markDirty();\n }\n \n getInterval(): number {\n return this._interval;\n }\n\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — OrderedList widget\n// ─────────────────────────────────────────────────────\nimport {\n type Screen,\n type Style,\n styleToCellAttrs,\n truncate,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface OrderedListItem {\n text: string;\n /** Nested items */\n children?: OrderedListItem[];\n}\n\nexport interface OrderedListOptions {\n /** Indent width per level. Default: 3 */\n indent?: number;\n /** Numbering style: '1.' for arabic, 'a.' for lowercase alpha, 'i.' for lowercase roman. Default: '1.' */\n style?: '1.' | 'a.' | 'i.';\n}\n\ninterface FlatRow {\n text: string;\n prefix: string;\n depth: number;\n}\n\nfunction toAlpha(n: number): string {\n let result = '';\n while (n > 0) {\n n--;\n result = String.fromCharCode(97 + (n % 26)) + result;\n n = Math.floor(n / 26);\n }\n return result || 'a';\n}\n\nfunction toRoman(n: number): string {\n const vals = [1000,900,500,400,100,90,50,40,10,9,5,4,1];\n const syms = ['m','cm','d','cd','c','xc','l','xl','x','ix','v','iv','i'];\n let result = '';\n for (let i = 0; i < vals.length; i++) {\n while (n >= vals[i]) {\n result += syms[i];\n n -= vals[i];\n }\n }\n return result;\n}\n\nfunction getPrefix(index: number, style: '1.' | 'a.' | 'i.'): string {\n switch (style) {\n case 'a.': return toAlpha(index) + '.';\n case 'i.': return toRoman(index) + '.';\n default: return index + '.';\n }\n}\n\nfunction flattenItems(\n items: OrderedListItem[],\n depth: number,\n style: '1.' | 'a.' | 'i.',\n out: FlatRow[],\n): void {\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n out.push({\n text: item.text,\n prefix: getPrefix(i + 1, style),\n depth,\n });\n if (item.children && item.children.length > 0) {\n flattenItems(item.children, depth + 1, style, out);\n }\n }\n}\n\n/**\n * OrderedList — renders a numbered list with optional nesting.\n */\nexport class OrderedList extends Widget {\n private _items: OrderedListItem[];\n private _opts: Required<OrderedListOptions>;\n\n constructor(\n items: OrderedListItem[],\n style: Partial<Style> = {},\n opts: OrderedListOptions = {},\n ) {\n super(style);\n this._items = items;\n this._opts = {\n indent: Math.max(0, opts.indent ?? 3),\n style: opts.style ?? '1.',\n };\n }\n\n setItems(items: OrderedListItem[]): void {\n if (items === this._items) {\n return;\n }\n this._items = items;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const rows: FlatRow[] = [];\n flattenItems(this._items, 0, this._opts.style, rows);\n\n const visibleCount = Math.min(rows.length, height);\n for (let i = 0; i < visibleCount; i++) {\n const { text, prefix, depth } = rows[i];\n const indentStr = ' '.repeat(this._opts.indent * depth);\n let line = `${indentStr}${prefix} ${text}`;\n line = truncate(line, width);\n screen.writeString(x, y + i, line, attrs);\n }\n }\n}\n","import { Widget } from '../base/Widget.js';\nimport { type Screen, type Style, caps, styleToCellAttrs, stringWidth } from '@termuijs/core';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// TypewriterOptions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface TypewriterOptions {\n /** Characters revealed per tick. Must be a positive integer. Default: 1 */\n speed?: number;\n /** Cursor glyph drawn at the reveal head. Default: caps-aware block. */\n cursor?: string;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Typewriter\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst segmenter = new Intl.Segmenter();\n\n/**\n * Reveals static text character by character.\n *\n * The host is responsible for calling `tick()` at whatever cadence it likes\n * (timer, animation loop, etc.). No internal timer is used.\n *\n * @example\n * ```ts\n * const tw = new Typewriter('hello world');\n * const interval = setInterval(() => {\n * tw.tick();\n * screen.render();\n * }, 80);\n * ```\n */\nexport class Typewriter extends Widget {\n private _text: string;\n private _revealed: number;\n private _speed: number;\n private _cursor: string | undefined;\n\n constructor(\n text: string,\n style: Partial<Style> = {},\n opts: TypewriterOptions = {},\n ) {\n super(style);\n this._text = text;\n this._revealed = 0;\n // Clamp speed to a positive integer: non-positive, NaN, and fractional\n // values would cause reveal to stall or behave non-deterministically.\n const raw = opts.speed ?? 1;\n this._speed = Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 1;\n // undefined means \"auto from caps at render time\"; a caller-supplied string\n // overrides it unconditionally.\n this._cursor = opts.cursor;\n }\n\n // ── Public mutating methods ────────────────────────────────────────────────\n\n /** Advance the reveal head by `speed` characters. No-op once fully revealed. */\n tick(): void {\n const len = Array.from(segmenter.segment(this._text)).length;\n if (this._revealed >= len) return;\n this._revealed = Math.min(this._revealed + this._speed, len);\n this.markDirty();\n }\n\n /** Return the reveal counter to zero. */\n reset(): void {\n this._revealed = 0;\n this.markDirty();\n }\n\n /** Replace the text and reset the reveal counter. */\n setText(text: string): void {\n this._text = text;\n this._revealed = 0;\n this.markDirty();\n }\n\n // ── Rendering ─────────────────────────────────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n if (width <= 0 || height <= 0) return;\n\n const segments = Array.from(segmenter.segment(this._text));\n const fullyRevealed = this._revealed >= segments.length;\n\n // Cursor glyph: caller-supplied string wins; otherwise caps-aware default.\n const cursorGlyph =\n this._cursor ?? (caps.unicode ? '▋' : '_');\n\n // Visible text slice (by grapheme cluster count).\n const visibleText = segments.slice(0, this._revealed).map(s => s.segment).join('');\n\n // Append cursor when not yet fully revealed.\n const lineWithCursor = fullyRevealed\n ? visibleText\n : visibleText + cursorGlyph;\n\n // Truncate to the available terminal columns using display-width-aware\n // slicing so that full-width Unicode glyphs (e.g. CJK) never overflow\n // the content rect. stringWidth() counts terminal columns, not code units.\n let line = '';\n let cols = 0;\n const lineSegments = segmenter.segment(lineWithCursor);\n for (const { segment } of lineSegments) {\n const w = stringWidth(segment);\n if (cols + w > width) break;\n line += segment;\n cols += w;\n }\n\n const attrs = styleToCellAttrs(this._style);\n screen.writeString(x, y, line, attrs);\n }\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Timeline widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, styleToCellAttrs, caps } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type TimelineStatus = 'done' | 'active' | 'pending';\n\nexport interface TimelineItem {\n title: string;\n time?: string;\n status?: TimelineStatus;\n}\n\n/**\n * Timeline — renders a vertical list of timeline items.\n *\n * Each item gets a connector (├─ / └─) and a status icon:\n * ● active (cyan/bold), ✓ done (green), ○ pending (dim).\n */\nexport class Timeline extends Widget {\n private _items: TimelineItem[];\n\n constructor(\n items: TimelineItem[],\n style: Partial<Style> = {},\n ) {\n super(style);\n this._items = items;\n }\n\n setItems(items: TimelineItem[]): void {\n this._items = items;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || this._items.length === 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const visibleCount = Math.min(this._items.length, height);\n\n for (let i = 0; i < visibleCount; i++) {\n const item = this._items[i];\n const isLast = i === this._items.length - 1;\n const status = item.status ?? 'pending';\n\n let connector: string;\n if (isLast) {\n connector = '\\u2514\\u2500'; // └─\n } else {\n connector = '\\u251C\\u2500'; // ├─\n }\n\n let icon: string;\n if (caps.unicode) {\n switch (status) {\n case 'active':\n icon = '\\u25CF'; // ●\n break;\n case 'done':\n icon = '\\u2713'; // ✓\n break;\n default:\n icon = '\\u25CB'; // ○\n break;\n }\n } else {\n switch (status) {\n case 'done':\n icon = 'v';\n break;\n default:\n icon = 'o';\n break;\n }\n }\n\n const isActive = status === 'active';\n const isDone = status === 'done';\n const isPending = status === 'pending';\n\n const statusColor: Color = isDone\n ? { type: 'named', name: 'green' }\n : isActive\n ? { type: 'named', name: 'cyan' }\n : { type: 'named', name: 'white' };\n\n // Connector + icon portion: e.g. \"├─ ● \"\n const iconX = x + connector.length;\n const titleX = iconX + 2;\n\n screen.writeString(x, y + i, connector, {\n ...attrs,\n fg: statusColor,\n bold: isActive,\n dim: isPending,\n });\n\n screen.setCell(iconX, y + i, {\n char: icon,\n fg: statusColor,\n bold: isActive,\n dim: isPending,\n });\n\n screen.writeString(titleX, y + i, item.title, {\n ...attrs,\n bold: isActive,\n dim: isPending,\n });\n\n // Time — dimmed right-aligned\n if (item.time) {\n const timeStr = ` ${item.time}`;\n const timeX = x + width - timeStr.length;\n if (timeX > titleX) {\n screen.writeString(timeX, y + i, timeStr, {\n ...attrs,\n dim: true,\n });\n }\n }\n }\n }\n}\n","import { type Screen, type Style, styleToCellAttrs, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type MarqueeDirection = 'left' | 'right';\n\nexport interface MarqueeOptions {\n direction?: MarqueeDirection;\n speed?: number;\n gap?: number;\n}\n\nexport class Marquee extends Widget {\n private _text: string;\n private _direction: MarqueeDirection;\n private _speed: number;\n private _gap: number;\n private _offset: number = 0;\n\n constructor(text: string, style: Partial<Style> = {}, opts: MarqueeOptions = {}) {\n super(style);\n this._text = text;\n this._direction = opts.direction ?? 'left';\n this._speed = opts.speed ?? 1;\n this._gap = opts.gap ?? 4;\n }\n\n tick(): void {\n this._offset += this._speed;\n this.markDirty();\n }\n\n setText(text: string): void {\n if (text === this._text) return;\n this._text = text;\n this._offset = 0;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0 || !this._text) return;\n\n const attrs = styleToCellAttrs(this._style);\n\n const textW = stringWidth(this._text);\n if (textW === 0) return;\n\n const gapSpaces = ' '.repeat(this._gap);\n const repeatLen = textW + this._gap;\n\n const totalNeeded = width + repeatLen;\n const repeats = Math.ceil(totalNeeded / repeatLen);\n let full = '';\n for (let i = 0; i < repeats; i++) {\n full += this._text + gapSpaces;\n }\n\n const effectiveOffset = this._direction === 'left'\n ? (this._offset % repeatLen)\n : (repeatLen - (this._offset % repeatLen));\n\n const start = effectiveOffset % full.length;\n const visible = full.slice(start, start + width);\n\n screen.writeString(x, y, visible, attrs);\n }\n}\n","// ─────────────────────────────────────────────────────────────────────────────\n// @termuijs/widgets — DataGrid widget\n//\n// A table with sort indicators and a filter row. Extends Table and adds:\n// - `s` key cycles sort on the selected column (none → asc → desc → none)\n// - `/` opens a filter row; typing narrows displayed rows\n// - `escape` closes the filter row and clears the filter\n// - Sort indicators: ▲ / ▼ (Unicode) or ^ / v (ASCII) appended to headers\n// ─────────────────────────────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type KeyEvent,\n styleToCellAttrs,\n stringWidth,\n truncate,\n caps,\n} from '@termuijs/core';\nimport { Table, type TableColumn, type TableRow, type TableOptions } from './Table.js';\n\nexport type SortDirection = 'asc' | 'desc' | 'none';\n\nexport interface DataGridColumn extends TableColumn {\n /** Whether the column can be sorted. Default: true. */\n sortable?: boolean;\n}\n\nexport type DataGridRow = TableRow;\n\nexport interface DataGridOptions extends TableOptions {\n /** Callback fired when sort changes. */\n onSort?: (key: string, direction: SortDirection) => void;\n /** Callback fired when the filter changes. */\n onFilter?: (filter: string) => void;\n}\n\nexport class DataGrid extends Table {\n private _onSort?: (key: string, direction: SortDirection) => void;\n private _onFilter?: (filter: string) => void;\n\n private _sortKey: string | null = null;\n private _sortDir: SortDirection = 'none';\n private _filter = '';\n private _filterOpen = false;\n private _selectedCol = 0;\n\n focusable = true;\n\n constructor(\n columns: DataGridColumn[],\n rows: DataGridRow[],\n style: Partial<Style> = {},\n options: DataGridOptions = {},\n ) {\n const normalizedColumns: DataGridColumn[] = columns.map(c => ({\n ...c,\n sortable: c.sortable ?? true,\n }));\n super(normalizedColumns, rows, style, options);\n this._onSort = options.onSort;\n this._onFilter = options.onFilter;\n }\n\n // ── Public API ──────────────────────────────────\n\n get sortKey(): string | null { return this._sortKey; }\n get sortDirection(): SortDirection { return this._sortDir; }\n get filter(): string { return this._filter; }\n get filterOpen(): boolean { return this._filterOpen; }\n get selectedColumn(): number { return this._selectedCol; }\n\n setSelectedColumn(col: number): void {\n if (col < 0 || col >= this._columns.length) return;\n this._selectedCol = col;\n this.markDirty();\n }\n\n setFilter(filter: string): void {\n this._filter = filter;\n this._filterOpen = true;\n this._onFilter?.(filter);\n this.markDirty();\n }\n\n clearFilter(): void {\n if (this._filter === '' && !this._filterOpen) return;\n this._filter = '';\n this._filterOpen = false;\n this._onFilter?.('');\n this.markDirty();\n }\n\n cycleSort(): void {\n const column = this._columns[this._selectedCol] as DataGridColumn | undefined;\n if (!column || column.sortable === false) return;\n\n if (this._sortKey !== column.key) {\n this._sortKey = column.key;\n this._sortDir = 'asc';\n } else if (this._sortDir === 'asc') {\n this._sortDir = 'desc';\n } else if (this._sortDir === 'desc') {\n this._sortDir = 'none';\n this._sortKey = null;\n } else {\n this._sortDir = 'asc';\n }\n\n this._onSort?.(column.key, this._sortDir);\n this.markDirty();\n }\n\n handleKey(event: KeyEvent): void {\n // While filter is open, capture printable keys + escape + backspace.\n if (this._filterOpen) {\n switch (event.key) {\n case 'escape':\n this.clearFilter();\n return;\n case 'backspace':\n if (this._filter.length > 0) {\n this.setFilter(this._filter.slice(0, -1));\n }\n return;\n default:\n if (\n event.key.length === 1\n && !event.ctrl\n && !event.alt\n ) {\n this.setFilter(this._filter + event.key);\n }\n return;\n }\n }\n\n // Normal mode: navigation + sort + filter\n switch (event.key) {\n case 's':\n case 'S':\n if (!event.ctrl && !event.alt) this.cycleSort();\n break;\n case '/':\n this._filterOpen = true;\n this.markDirty();\n break;\n case 'escape':\n this.clearFilter();\n break;\n case 'left':\n this.setSelectedColumn(this._selectedCol - 1);\n break;\n case 'right':\n this.setSelectedColumn(this._selectedCol + 1);\n break;\n }\n }\n\n // ── Rendering ───────────────────────────────────\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const sepWidth = stringWidth(this._separator);\n const sortIndicator = (dir: SortDirection): string => {\n if (dir === 'asc') return caps.unicode ? ' \\u25B2' : ' ^';\n if (dir === 'desc') return caps.unicode ? ' \\u25BC' : ' v';\n return '';\n };\n\n const filterRowHeight = this._filterOpen ? 1 : 0;\n const filterY = y;\n const tableY = y + filterRowHeight;\n const tableHeight = Math.max(0, height - filterRowHeight);\n\n if (this._filterOpen) {\n const filterText = `/${this._filter}`;\n screen.writeString(x, filterY, truncate(filterText, width), { ...attrs, dim: true });\n }\n\n if (tableHeight <= 0) return;\n\n // Available width for headers and data\n const usableWidth = width - (this._columns.length - 1) * sepWidth;\n const colWidths = this._computeColumnWidths(usableWidth);\n\n let row = 0;\n\n if (this._showHeader && row < tableHeight) {\n let cx = x;\n for (let c = 0; c < this._columns.length; c++) {\n const col = this._columns[c] as DataGridColumn;\n const isSortKey = this._sortKey === col.key;\n const indicator = isSortKey ? sortIndicator(this._sortDir) : '';\n const indicatorStripped = stringWidth(indicator);\n const cellWidth = colWidths[c] ?? 0;\n const headerWidth = Math.max(0, cellWidth - indicatorStripped);\n const headerText = this._alignText(col.header, headerWidth, col.align ?? 'left');\n\n screen.writeString(cx, tableY + row, headerText, {\n ...attrs,\n bold: true,\n underline: c === this._selectedCol,\n });\n\n if (indicator) {\n screen.writeString(cx + headerWidth, tableY + row, indicator, {\n ...attrs,\n bold: true,\n });\n }\n\n cx += cellWidth;\n if (c < this._columns.length - 1) {\n screen.writeString(cx, tableY + row, this._separator, { ...attrs, dim: true });\n cx += sepWidth;\n }\n }\n row++;\n\n // Header separator line\n if (row < tableHeight) {\n const sepLine = (caps.unicode ? '\\u2500' : '-').repeat(width);\n screen.writeString(x, tableY + row, sepLine, { ...attrs, dim: true });\n row++;\n }\n }\n\n const dataRows = this._getVisibleRows();\n for (let r = 0; r < dataRows.length && row < tableHeight; r++) {\n const dataRow = dataRows[r];\n if (!dataRow) continue;\n const isStripe = this._stripe && r % 2 === 1;\n let cx = x;\n\n for (let c = 0; c < this._columns.length; c++) {\n const col = this._columns[c];\n const cellWidth = colWidths[c] ?? 0;\n const rawValue = String(dataRow[col.key] ?? '');\n const cellText = this._alignText(rawValue, cellWidth, col.align ?? 'left');\n\n screen.writeString(cx, tableY + row, cellText, {\n ...attrs,\n bg: isStripe ? this._stripeColor : attrs.bg,\n });\n cx += cellWidth;\n if (c < this._columns.length - 1) {\n screen.writeString(cx, tableY + row, this._separator, {\n ...attrs,\n dim: true,\n bg: isStripe ? this._stripeColor : attrs.bg,\n });\n cx += sepWidth;\n }\n }\n\n if (isStripe) {\n for (let fx = cx; fx < x + width; fx++) {\n screen.setCell(fx, tableY + row, { char: ' ', bg: this._stripeColor });\n }\n }\n\n row++;\n }\n }\n\n private _getVisibleRows(): DataGridRow[] {\n let rows = [...this._rows];\n if (this._filter.length > 0) {\n const needle = this._filter.toLowerCase();\n rows = rows.filter(r =>\n this._columns.some(c => {\n const v = r[c.key];\n return v !== undefined && String(v).toLowerCase().includes(needle);\n }),\n );\n }\n if (this._sortDir !== 'none' && this._sortKey !== null) {\n const key = this._sortKey;\n const dir = this._sortDir;\n rows.sort((a, b) => {\n const left = a[key] ?? '';\n const right = b[key] ?? '';\n if (typeof left === 'number' && typeof right === 'number') {\n return dir === 'asc' ? left - right : right - left;\n }\n const l = String(left);\n const r = String(right);\n if (l === r) return 0;\n return dir === 'asc' ? (l > r ? 1 : -1) : (l < r ? 1 : -1);\n });\n }\n return rows;\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — PieChart widget\n//\n// Renders proportional slices using block characters\n// (Unicode) or a horizontal bar chart (ASCII fallback),\n// with a legend below.\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type Color,\n styleToCellAttrs,\n caps,\n parseColor,\n truncate,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface PieSlice {\n label: string;\n value: number;\n color: string | Color;\n}\n\nexport interface PieChartOptions {\n slices?: PieSlice[];\n style?: Partial<Style>;\n showLegend?: boolean;\n}\n\nconst LEGEND_BULLET_UNICODE = '\\u25CF';\nconst LEGEND_BULLET_ASCII = '*';\n\nexport class PieChart extends Widget {\n private _slices: PieSlice[];\n private _showLegend: boolean;\n\n constructor(options: PieChartOptions = {}) {\n super(options.style);\n this._slices = options.slices ?? [];\n this._showLegend = options.showLegend ?? true;\n }\n\n get slices(): ReadonlyArray<PieSlice> { return this._slices; }\n\n setSlices(slices: PieSlice[]): void {\n this._slices = slices;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n if (width <= 0 || height <= 0) return;\n\n if (this._slices.length === 0) return;\n\n const totalHeight = this._showLegend ? Math.max(0, height - this._slices.length) : height;\n if (totalHeight <= 0) {\n this._renderLegend(screen, x, y, width);\n return;\n }\n\n if (caps.unicode) {\n this._renderPie(screen, x, y, width, totalHeight);\n } else {\n this._renderBars(screen, x, y, width, totalHeight);\n }\n\n if (this._showLegend) {\n this._renderLegend(screen, x, y + totalHeight, width);\n }\n }\n\n // ── Unicode pie ──────────────────────────────────\n\n private _renderPie(screen: Screen, ox: number, oy: number, width: number, height: number): void {\n const total = this._total();\n if (total <= 0) return;\n\n const cx = (width - 1) / 2;\n const cy = (height - 1) / 2;\n // Each cell is ~2x taller than wide; scale vertical to match.\n const radius = Math.min(cx, cy * 2);\n\n for (let row = 0; row < height; row++) {\n for (let col = 0; col < width; col++) {\n const dx = col - cx;\n const dy = (row - cy) * 2;\n const r = Math.sqrt(dx * dx + dy * dy);\n if (r > radius) continue;\n\n const slice = this._findSliceAt(dx, dy, total);\n if (!slice) continue;\n screen.setCell(ox + col, oy + row, { char: '\\u2588', fg: this._colorOf(slice) });\n }\n }\n }\n\n private _findSliceAt(dx: number, dy: number, total: number): PieSlice | null {\n // 0 rad = up, clockwise\n const angle = Math.atan2(dx, -dy);\n const normalized = (angle + Math.PI * 2) % (Math.PI * 2);\n let cumulative = 0;\n for (const slice of this._slices) {\n if (slice.value <= 0) continue;\n const sliceAngle = (slice.value / total) * Math.PI * 2;\n if (normalized < cumulative + sliceAngle) return slice;\n cumulative += sliceAngle;\n }\n return this._slices[this._slices.length - 1] ?? null;\n }\n\n // ── ASCII bar fallback ──────────────────────────\n\n private _renderBars(screen: Screen, ox: number, oy: number, width: number, height: number): void {\n const total = this._total();\n if (total <= 0) return;\n const maxValue = Math.max(...this._slices.map(s => s.value));\n if (maxValue <= 0) return;\n\n const usable = Math.max(1, width - 8);\n for (let i = 0; i < this._slices.length && i < height; i++) {\n const slice = this._slices[i];\n if (!slice) continue;\n const barLen = Math.round((slice.value / maxValue) * usable);\n const pct = Math.round((slice.value / total) * 100);\n const line = '#'.repeat(barLen).padEnd(usable) + ` ${String(pct).padStart(3)}%`;\n screen.writeString(ox, oy + i, line.slice(0, width), { ...styleToCellAttrs(this._style), fg: this._colorOf(slice) });\n }\n }\n\n // ── Legend ───────────────────────────────────────\n\n private _renderLegend(screen: Screen, ox: number, oy: number, width: number): void {\n const total = this._total();\n const bullet = caps.unicode ? LEGEND_BULLET_UNICODE : LEGEND_BULLET_ASCII;\n const attrs = styleToCellAttrs(this._style);\n for (let i = 0; i < this._slices.length; i++) {\n const slice = this._slices[i];\n if (!slice) continue;\n const pct = total > 0 ? Math.round((slice.value / total) * 100) : 0;\n const text = `${bullet} ${slice.label} ${pct}%`;\n screen.writeString(ox, oy + i, truncate(text, width), { ...attrs, fg: this._colorOf(slice) });\n }\n }\n\n private _total(): number {\n return this._slices.reduce((s, x) => s + (x.value > 0 ? x.value : 0), 0);\n }\n\n private _colorOf(slice: PieSlice): Color {\n return typeof slice.color === 'string' ? parseColor(slice.color) : slice.color;\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Progress Column Definitions\n// ─────────────────────────────────────────────────────\n\nexport interface ProgressColumnProps {\n maxRefresh?: number;\n}\n\nexport interface TextColumnProps extends ProgressColumnProps {\n template?: string;\n}\n\nexport type ProgressColumnRenderer = (\n task: Record<string, unknown>,\n) => string;\n\nexport interface ProgressColumnDefinition {\n kind: 'bar' | 'text' | 'time' | 'speed' | 'percentage';\n maxRefresh?: number;\n template?: string;\n render?: ProgressColumnRenderer;\n}\n\n\nexport function BarColumn(\n props: ProgressColumnProps = {},\n): ProgressColumnDefinition {\n return {\n kind: 'bar',\n ...props,\n };\n}\n\nexport function TextColumn(\n props: TextColumnProps = {},\n): ProgressColumnDefinition {\n return {\n kind: 'text',\n template: props.template,\n maxRefresh: props.maxRefresh,\n };\n}\n\nexport function TimeColumn(\n props: ProgressColumnProps = {},\n): ProgressColumnDefinition {\n return {\n kind: 'time',\n ...props,\n };\n}\n\nexport function SpeedColumn(\n props: ProgressColumnProps = {},\n): ProgressColumnDefinition {\n return {\n kind: 'speed',\n ...props,\n };\n}\n\nexport function PercentageColumn(\n props: ProgressColumnProps = {},\n): ProgressColumnDefinition {\n return {\n kind: 'percentage',\n ...props,\n };\n}","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Progress\n// ─────────────────────────────────────────────────────\n\nimport { Widget } from '../base/Widget.js';\nimport type { ProgressColumnDefinition } from './ProgressColumn.js';\nimport {\n BarColumn,\n TextColumn,\n TimeColumn,\n SpeedColumn,\n PercentageColumn,\n} from './ProgressColumn.js';\nimport type { Screen, Style } from '@termuijs/core';\nexport interface ProgressTask {\n label?: string;\n value?: number;\n status?: string;\n [key: string]: unknown;\n}\n\nexport interface ProgressProps {\n tasks?: ProgressTask[];\n columns?: ProgressColumnDefinition[];\n children?: unknown;\n}\n\nexport class Progress extends Widget {\n private _tasks: ProgressTask[];\n private _columns: ProgressColumnDefinition[];\n \n private _lastRefreshTimes = new Map<number, number>();\n private _columnCache = new Map<string, string>();\n\n private _resolveColumns(\n children?: unknown,\n): ProgressColumnDefinition[] {\n if (!children) return [];\n\n const items = Array.isArray(children)\n ? children\n : [children];\n\n const columns: ProgressColumnDefinition[] = [];\n\n for (const item of items) {\n if (\n item &&\n typeof item === 'object' &&\n 'type' in (item as Record<string, unknown>)\n ) {\n const vnode = item as {\n type?: unknown;\n props?: Record<string, unknown>;\n };\n\n const props = vnode.props ?? {};\n\n if (vnode.type === BarColumn) {\n columns.push(BarColumn(props));\n } else if (vnode.type === TextColumn) {\n columns.push(TextColumn(props));\n } else if (vnode.type === PercentageColumn) {\n columns.push(PercentageColumn(props));\n } else if (vnode.type === TimeColumn) {\n columns.push(TimeColumn(props));\n }else if (vnode.type === SpeedColumn) {\n columns.push(SpeedColumn(props));\n }\n }\n }\n\n return columns;\n}\n\n constructor(\n props: ProgressProps = {},\n style: Partial<Style> = {},\n ) {\n super(style);\n\n this._tasks = props.tasks ?? [];\n \n const childColumns = this._resolveColumns(\n props.children,\n);\n\nthis._columns =\n childColumns.length\n ? childColumns\n : props.columns?.length\n ? props.columns\n : [\n BarColumn(),\n TextColumn(),\n PercentageColumn(),\n ];\n \n \n }\n\n get tasks(): ProgressTask[] {\n return this._tasks;\n }\n\n get columns(): ProgressColumnDefinition[] {\n return this._columns;\n }\n\n public setTasks(tasks: ProgressTask[]): void {\n if (tasks === this._tasks) {\n return;\n }\n this._tasks = tasks;\n this.markDirty();\n}\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const { x, y, width, height } = rect;\n\n if (width <= 0 || height <= 0) return;\n\n this._tasks.forEach((task, index) => {\n if (index >= height) return;\n\n const parts: string[] = [];\n\n for (const [columnIndex, column] of this._columns.entries()) {\n\n if (column.render) {\n parts.push(column.render(task));\n continue;\n }\n\n const refreshRate = column.maxRefresh;\n\nif (\n refreshRate &&\n (column.kind === 'time' || column.kind === 'speed')\n) {\n const now = Date.now();\n\n const last =\n this._lastRefreshTimes.get(columnIndex) ?? 0;\n\n const intervalMs = 1000 / refreshRate;\n if (now - last < intervalMs) { \n const cached = this._columnCache.get(\n `${index}-${columnIndex}`,\n );\n if (cached) {\n parts.push(cached);\n }\n continue;\n }\n\n this._lastRefreshTimes.set(\n columnIndex,\n now,\n );\n}\n\n switch (column.kind) {\n case 'text': {\n const template = column.template;\n\n if (template) {\n const match = template.match(\n /^\\{task\\.([a-zA-Z0-9_]+)\\}$/\n );\n\n if (match) {\n parts.push(\n String(\n task[match[1]] ?? ''\n )\n );\n } else {\n parts.push(template);\n }\n } else {\n parts.push(String(task.label ?? ''));\n }\n\n break;\n}\n\n case 'percentage':\n parts.push(`${Math.round((task.value ?? 0) * 100)}%`);\n break;\n\n case 'bar': {\n const value = Math.max(0, Math.min(1, task.value ?? 0));\n const filled = Math.round(value * 10);\n const empty = 10 - filled;\n\n parts.push(\n `[${'█'.repeat(filled)}${'░'.repeat(empty)}]`,\n );\n break;\n }\n\n case 'time': {\n const value = '--:--';\n this._columnCache.set(\n `${index}-${columnIndex}`,\n value,\n );\n parts.push(value);\n break;\n }\n case 'speed': {\n const value = '--/s';\n this._columnCache.set(\n `${index}-${columnIndex}`,\n value,\n );\n parts.push(value);\n break;\n}\n }\n }\n\n screen.writeString(\n x,\n y + index,\n parts.join(' '),\n this.style,\n );\n });\n}\n}\n","import { type Style, parseColor, stringWidth } from '@termuijs/core';\nimport { Box } from './Box.js';\nimport { Text } from './Text.js';\n\nconst escapeRegExp = (v: string) => v.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\nconst DEFAULT_STYLE: Partial<Style> = {\n bg: parseColor('yellow'),\n fg: parseColor('black'),\n};\n\nexport class Highlight extends Box {\n constructor(text: string, query: string | RegExp, style?: Partial<Style>) {\n super({ flexDirection: 'row' });\n this._buildSegments(text, query, style);\n }\n\n private _buildSegments(text: string, query: string | RegExp, highlightStyle?: Partial<Style>): void {\n const style = highlightStyle ?? DEFAULT_STYLE;\n\n if (!query) {\n this.addChild(new Text(text, { width: stringWidth(text), height: 1 }));\n return;\n }\n\n const pattern = query instanceof RegExp ? query.source : escapeRegExp(query);\n const baseFlags = query instanceof RegExp ? query.flags : 'i';\n const splitFlags = baseFlags.includes('g') ? baseFlags : `${baseFlags}g`;\n const splitRegex = new RegExp(`(${pattern})`, splitFlags);\n const matchRegex = new RegExp(`^(?:${pattern})$`, baseFlags.replace(/g/g, ''));\n\n for (const part of text.split(splitRegex)) {\n const partStyle = matchRegex.test(part) ? { ...style, width: stringWidth(part), height: 1 } : { width: stringWidth(part), height: 1 };\n this.addChild(new Text(part, partStyle));\n }\n }\n\n update(text: string, query: string | RegExp, style?: Partial<Style>): void {\n this.clearChildren();\n this._buildSegments(text, query, style);\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — ThinkingBlock widget\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type KeyEvent,\n styleToCellAttrs,\n wordWrap,\n caps,\n prefersReducedMotion,\n} from '@termuijs/core';\n\nimport { timerPoolSubscribe } from '@termuijs/motion';\nimport { Widget } from '../base/Widget.js';\n\nexport interface ThinkingBlockOptions {\n width?: number;\n thinking?: string;\n}\n\nexport class ThinkingBlock extends Widget {\n private _text: string;\n private _expanded = false;\n private _streaming = false;\n\n private _dots = '';\n private _timerUnsub?: () => void;\n\n constructor(\n options: ThinkingBlockOptions = {},\n style: Partial<Style> = {},\n ) {\n super(style);\n\n this._text = options.thinking ?? '';\n this.focusable = true;\n }\n\n appendText(chunk: string): void {\n this._text += chunk;\n this.markDirty();\n }\n\n setStreaming(streaming: boolean): void {\n this._streaming = streaming;\n this.markDirty();\n }\n\n toggle(): void {\n this._expanded = !this._expanded;\n this.markDirty();\n }\n\n handleKey(event: KeyEvent): void {\n if (event.key === 'enter' || event.key === 't') {\n this.toggle();\n }\n }\n\n mount(): void {\n super.mount();\n\n if (prefersReducedMotion()) return;\n\n this._timerUnsub = timerPoolSubscribe(300, () => {\n this._dots =\n this._dots.length >= 3\n ? ''\n : this._dots + '.';\n\n this.markDirty();\n });\n }\n\n unmount(): void {\n this._timerUnsub?.();\n this._timerUnsub = undefined;\n super.unmount();\n }\n\n protected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const attrs = styleToCellAttrs(this._style);\n\n if (!this._expanded) {\n const text = `[thinking${this._streaming ? this._dots : ''}]`;\n screen.writeString(rect.x, rect.y, text, attrs);\n return;\n }\n\n const boxWidth = Math.max(4, rect.width);\n\n const tl = caps.unicode ? '┌' : '+';\n const tr = caps.unicode ? '┐' : '+';\n const bl = caps.unicode ? '└' : '+';\n const br = caps.unicode ? '┘' : '+';\n const h = caps.unicode ? '─' : '-';\n const v = caps.unicode ? '│' : '|';\n\n screen.writeString(\n rect.x,\n rect.y,\n tl + h.repeat(Math.max(0, boxWidth - 2)) + tr,\n attrs,\n );\n\n const wrapped = wordWrap(\n this._text +\n (this._streaming ? `\\n\\nthinking${this._dots}` : ''),\n Math.max(1, boxWidth - 4),\n );\n\n const lines = wrapped.split('\\n');\n\n const availableHeight = Math.max(0, rect.height - 2);\n const limit = Math.min(lines.length, availableHeight);\n\n for (let i = 0; i < limit; i++) {\n const line = lines[i];\n\n screen.writeString(\n rect.x,\n rect.y + i + 1,\n v,\n attrs,\n );\n\n screen.writeString(\n rect.x + 2,\n rect.y + i + 1,\n line,\n attrs,\n );\n\n screen.writeString(\n rect.x + boxWidth - 1,\n rect.y + i + 1,\n v,\n attrs,\n );\n }\n\n screen.writeString(\n rect.x,\n rect.y + limit + 1,\n bl + h.repeat(Math.max(0, boxWidth - 2)) + br,\n attrs,\n );\n }\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Collapsible widget\n//\n// A toggleable section with a clickable title bar and\n// a hidden or visible body. Press Enter or Space to toggle.\n// ─────────────────────────────────────────────────────\n\nimport {\n type Screen,\n type Style,\n type KeyEvent,\n styleToCellAttrs,\n truncate,\n caps,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface CollapsibleOptions {\n /** Start open. Default: false */\n open?: boolean;\n /** Expand indicator char. Default: '▶' (or '>' in ASCII) */\n expandChar?: string;\n /** Collapse indicator char. Default: '▼' (or 'v' in ASCII) */\n collapseChar?: string;\n /** Callback when toggled */\n onToggle?: (open: boolean) => void;\n}\n\n/**\n * Collapsible — a toggleable section with title and body.\n *\n * Renders:\n * - Row 0: [indicator] [title]\n * - Rows 1+: body lines (if open)\n *\n * Press Enter or Space to toggle open/closed state.\n */\nexport class Collapsible extends Widget {\n private _title: string;\n private _body: string;\n private _open: boolean;\n private _expandChar: string;\n private _collapseChar: string;\n private _onToggle?: (open: boolean) => void;\n focusable = true;\n\n constructor(\n title: string,\n body: string,\n style: Partial<Style> = {},\n opts: CollapsibleOptions = {},\n ) {\n const open = opts.open ?? false;\n const bodyLines = opts.open ? body.split('\\n').length : 0;\n super({ ...style, height: 1 + bodyLines });\n this._open = open;\n\n this._title = title;\n this._body = body;\n this._open = opts.open ?? false;\n this._expandChar = opts.expandChar ?? (caps.unicode ? '▶' : '>');\n this._collapseChar = opts.collapseChar ?? (caps.unicode ? '▼' : 'v');\n this._onToggle = opts.onToggle;\n }\n\n /** Update the title and re-render. */\n setTitle(title: string): void {\n this._title = title;\n this.markDirty();\n }\n\n /** Update the body and re-render. */\n setBody(body: string): void {\n this._body = body;\n const bodyLines = this._open ? body.split('\\n').length : 0;\n this.style.height = 1 + bodyLines;\n this.markDirty();\n }\n\n /** Toggle between open and closed. Fires onToggle callback. */\n toggle(): void {\n this._open = !this._open;\n const bodyLines = this._open ? this._body.split('\\n').length : 0;\n this.style.height = 1 + bodyLines;\n this._onToggle?.(this._open);\n this.markDirty();\n }\n\n /** Check if currently open. */\n isOpen(): boolean {\n return this._open;\n }\n\n /**\n * Handle key events.\n */\n handleKey(event: KeyEvent): void {\n switch (event.key) {\n case 'enter':\n case 'space':\n this.toggle();\n break;\n }\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._rect;\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this.style);\n\n // Row 0: indicator + title\n const indicator = this._open ? this._collapseChar : this._expandChar;\n const titleLine = indicator + ' ' + this._title;\n screen.writeString(x, y, truncate(titleLine, width), attrs);\n\n // Rows 1+: body (if open)\n if (this._open) {\n const bodyLines = this._body.split('\\n');\n for (let i = 0; i < bodyLines.length && i < height - 1; i++) {\n screen.writeString(x, y + 1 + i, truncate(bodyLines[i], width), attrs);\n }\n }\n }\n}\n","import { Widget } from '../base/Widget.js';\nimport { caps, type Screen, type Style, type KeyEvent, stringWidth, truncate } from '@termuijs/core';\n\nexport type TreeNode = {\nname: string;\ntype: 'file' | 'dir';\nchildren?: TreeNode[];\n};\n\nexport interface DirectoryTreeOptions {\ntree?: TreeNode[];\npath?: string;\nonSelect?: (node: TreeNode, path: string) => void;\n}\n\ntype VisibleNode = {\nnode: TreeNode;\ndepth: number;\npath: string[];\n};\n\nexport class DirectoryTree extends Widget {\nprivate _tree: TreeNode[] = [];\nprivate _visible: VisibleNode[] = [];\nprivate _selectedIndex = 0;\nprivate _expanded = new Set<string>();\n\n\nonSelect?: (node: TreeNode, path: string) => void;\n\nconstructor(\n options: DirectoryTreeOptions,\n style: Partial<Style> = {},\n) {\n super(style);\n\n this.onSelect = options.onSelect;\n this._tree = options.tree ?? [];\n\n this._rebuild();\n this.markDirty();\n}\n\nprivate _rebuild() {\n this._visible = [];\n this._walk(this._tree, [], 0);\n}\n\nprivate _walk(nodes: TreeNode[], path: string[], depth: number) {\n for (const node of nodes) {\n const currentPath = [...path, node.name];\n const key = currentPath.join('/');\n\n this._visible.push({\n node,\n depth,\n path: currentPath,\n });\n\n if (node.type === 'dir' && this._expanded.has(key)) {\n this._walk(node.children || [], currentPath, depth + 1);\n }\n }\n}\n\nprivate _toggle(node: TreeNode, path: string[]) {\n if (node.type !== 'dir') return;\n\n const key = path.join('/');\n\n if (this._expanded.has(key)) {\n this._expanded.delete(key);\n } else {\n this._expanded.add(key);\n }\n\n this._rebuild();\n this.markDirty();\n}\n\nprivate _select(node: TreeNode, path: string[]) {\n this.onSelect?.(node, path.join('/'));\n}\n\n handleKey(event: KeyEvent): boolean {\n const current = this._visible[this._selectedIndex];\n if (!current) return false;\n\n switch (event.key) {\n case 'down':\n this._selectedIndex = Math.min(\n this._selectedIndex + 1,\n this._visible.length - 1,\n );\n this.markDirty();\n return true;\n\n case 'up':\n this._selectedIndex = Math.max(\n this._selectedIndex - 1,\n 0,\n );\n this.markDirty();\n return true;\n\n case 'right':\n case 'enter':\n if (current.node.type === 'dir') {\n this._toggle(current.node, current.path);\n }\n return true;\n\n case 'left': {\n const keyPath = current.path.join('/');\n if (\n current.node.type === 'dir' &&\n this._expanded.has(keyPath)\n ) {\n this._toggle(current.node, current.path);\n }\n return true;\n }\n\n case 'space':\n this._select(current.node, current.path);\n return true;\n\n default:\n return false;\n }\n }\n\nprotected _renderSelf(screen: Screen): void {\n const rect = this._getContentRect();\n const width = rect.width;\n\n const fileIcon = caps.unicode ? '📄' : '[F]';\n const dirIcon = caps.unicode ? '📁' : '[D]';\n\n for (let i = 0; i < this._visible.length; i++) {\n const item = this._visible[i];\n const isSelected = i === this._selectedIndex;\n\n const indent = ' '.repeat(item.depth);\n const icon = item.node.type === 'dir' ? dirIcon : fileIcon;\n\n const line = `${indent}${icon} ${item.node.name}`;\n\n const text =\n stringWidth(line) > width\n ? truncate(line, width, '')\n : line;\n\n screen.writeString(rect.x, rect.y + i, text, {\n bold: isSelected,\n bg: isSelected\n ? { type: 'named' as const, name: 'blue' as const }\n : undefined,\n });\n }\n}\n\n\n}\n","// -----------------------------------------------------------------------------\n// @termuijs/widgets - UnorderedList widget\n// -----------------------------------------------------------------------------\n\nimport {\n type Screen,\n type Style,\n caps,\n styleToCellAttrs,\n truncate,\n} from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport interface ListItem {\n text: string;\n children?: ListItem[];\n}\n\nexport interface UnorderedListOptions {\n /** Bullet characters per nesting level. Default uses Unicode with ASCII fallback. */\n markers?: string[];\n /** Indent width per level. Default: 2 */\n indent?: number;\n}\n\ninterface VisibleItem {\n item: ListItem;\n depth: number;\n}\n\n/**\n * UnorderedList - renders a bulleted list with optional nested children.\n */\nexport class UnorderedList extends Widget {\n private _items: ListItem[];\n private _markers?: string[];\n private _indent: number;\n\n constructor(\n items: ListItem[],\n style: Partial<Style> = {},\n opts: UnorderedListOptions = {},\n ) {\n super(style);\n this._items = items;\n this._markers = opts.markers;\n this._indent = opts.indent ?? 2;\n }\n\n setItems(items: ListItem[]): void {\n this._items = items;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n if (width <= 0 || height <= 0) return;\n\n const attrs = styleToCellAttrs(this._style);\n const rows = _flattenItems(this._items);\n\n for (let i = 0; i < Math.min(rows.length, height); i++) {\n const row = rows[i];\n const marker = this._markerForDepth(row.depth);\n const indent = ' '.repeat(row.depth * this._indent);\n const line = truncate(`${indent}${marker} ${row.item.text}`, width);\n\n screen.writeString(x, y + i, line, attrs);\n }\n }\n\n private _markerForDepth(depth: number): string {\n const markers = this._markers ?? _defaultMarkers();\n if (markers.length === 0) return caps.unicode ? '\\u2022' : '*';\n\n return markers[Math.min(depth, markers.length - 1)];\n }\n}\n\nfunction _defaultMarkers(): string[] {\n return caps.unicode\n ? ['\\u2022', '\\u25E6', '\\u25AA']\n : ['*', '-', '+'];\n}\n\nfunction _flattenItems(items: ListItem[], depth = 0, out: VisibleItem[] = []): VisibleItem[] {\n for (const item of items) {\n out.push({ item, depth });\n if (item.children && item.children.length > 0) {\n _flattenItems(item.children, depth + 1, out);\n }\n }\n\n return out;\n}\n","// ─────────────────────────────────────────────────────\n// @termuijs/widgets — Rule widget (horizontal / vertical divider)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, type Color, caps, stringWidth } from '@termuijs/core';\nimport { Widget } from '../base/Widget.js';\n\nexport type RuleOrientation = 'horizontal' | 'vertical';\n\nexport interface RuleOptions {\n /** Line direction. Default: 'horizontal'. */\n orientation?: RuleOrientation;\n /** Title centered in the line (horizontal only). */\n title?: string;\n /** Line color. Default: brightBlack */\n color?: Color;\n}\n\n/** Default line color used when no color option is provided. */\nconst DEFAULT_COLOR: Color = { type: 'named', name: 'brightBlack' };\n\n/**\n * Rule — a horizontal or vertical divider line with an optional centered title.\n *\n * Horizontal example (no title):\n * ────────────────────\n *\n * Horizontal example (with title):\n * ────── Logs ──────\n *\n * Vertical example:\n * │\n * │\n * │\n *\n * Uses `caps.unicode` to choose between Unicode box-drawing and ASCII fallback.\n */\nexport class Rule extends Widget {\n private _orientation: RuleOrientation;\n private _title: string | undefined;\n private _color: Color;\n\n constructor(style: Partial<Style> = {}, opts: RuleOptions = {}) {\n super(style);\n this._orientation = opts.orientation ?? 'horizontal';\n this._title = opts.title;\n this._color = opts.color ?? DEFAULT_COLOR;\n }\n\n /** Update the title text. Calls markDirty(). */\n setTitle(title: string): void {\n if (title === this._title) {\n return;\n }\n this._title = title;\n this.markDirty();\n }\n\n protected _renderSelf(screen: Screen): void {\n const { x, y, width, height } = this._getContentRect();\n\n if (width <= 0 || height <= 0) {\n return;\n }\n const fg = this._color;\n const lineAttrs = { fg };\n\n if (this._orientation === 'vertical') {\n const vt = caps.unicode ? '│' : '|';\n for (let r = 0; r < height; r++) {\n screen.setCell(x, y + r, { char: vt, ...lineAttrs });\n }\n return;\n }\n\n // ── Horizontal ──\n const hz = caps.unicode ? '─' : '-';\n\n if (!this._title) {\n // No title — fill entire width with the line glyph\n for (let c = 0; c < width; c++) {\n screen.setCell(x + c, y, { char: hz, ...lineAttrs });\n }\n return;\n }\n\n // Title present — center it with a space on each side: \" Title \"\n const padded = ` ${this._title} `;\n const titleWidth = stringWidth(padded);\n\n if (titleWidth >= width) {\n // Title is too wide to leave room for line glyphs — just render it\n screen.writeString(x, y, padded.slice(0, width), lineAttrs);\n return;\n }\n\n const leftLen = Math.floor((width - titleWidth) / 2);\n const rightLen = width - leftLen - titleWidth;\n\n // Left line segment\n for (let c = 0; c < leftLen; c++) {\n screen.setCell(x + c, y, { char: hz, ...lineAttrs });\n }\n\n // Centered title\n screen.writeString(x + leftLen, y, padded, lineAttrs);\n\n // Right line segment\n const rightStart = leftLen + titleWidth;\n for (let c = 0; c < rightLen; c++) {\n screen.setCell(x + rightStart + c, y, { char: hz, ...lineAttrs });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIA,kBAgBO;AACP,oBAAsE;AActE,IAAI,mBAAmB;AAGhB,SAAS,wBAA8B;AAC1C,qBAAmB;AACvB;AA4BO,IAAe,SAAf,MAAsB;AA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AAE,MAAM,IAAI,GAAG,UAAU,CAAC;AAAA,MACvD;AACA;AAAA,IACJ;AAGA,UAAM,SAAS,IAAI,KAAK,MAAM;AAC9B,UAAM,iBAAa,2BAAY,MAAM;AAErC,QAAI,cAAc,OAAO;AAErB,aAAO,YAAY,GAAG,GAAG,OAAO,MAAM,GAAG,KAAK,GAAG,SAAS;AAC1D;AAAA,IACJ;AAEA,UAAM,UAAU,KAAK,OAAO,QAAQ,cAAc,CAAC;AACnD,UAAM,WAAW,QAAQ,UAAU;AAGnC,aAAS,IAAI,GAAG,IAAI,SAAS,KAAK;AAC9B,aAAO,QAAQ,IAAI,GAAG,GAAG,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;AAAA,IACvD;AAGA,WAAO,YAAY,IAAI,SAAS,GAAG,QAAQ,SAAS;AAGpD,UAAM,aAAa,UAAU;AAC7B,aAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AAC/B,aAAO,QAAQ,IAAI,aAAa,GAAG,GAAG,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;AAAA,IACpE;AAAA,EACJ;AACJ;","names":["import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_motion","import_core","import_core","import_core","x","y","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","_isParent","_collectVisible","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_motion","import_core","import_core","import_core","import_core","import_motion","import_core","import_core","import_core","VARIANT_COLORS","ICONS_UNICODE","ICONS_ASCII","import_core","import_core","ICONS_UNICODE","ICONS_ASCII","COLORS","avail","import_core","import_core","import_core","import_core","BrailleCanvas","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","segmenter","import_core","import_core","BG_COLORS","import_core","FG_COLOR","import_core","FG_COLORS","import_core","import_core","segmenter","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","import_core","minutes","mm","import_core","import_core","import_core","segmenter","import_core","import_core","import_core","import_core","import_core","import_core","import_motion","import_core","import_core","import_core","import_core"]}