@termuijs/widgets 0.1.2 → 0.1.4

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/input/List.ts","../src/input/TextInput.ts","../src/input/VirtualList.ts","../src/data/Table.ts","../src/data/Gauge.ts","../src/data/Sparkline.ts","../src/data/StatusIndicator.ts","../src/data/BarChart.ts","../src/feedback/ProgressBar.ts","../src/feedback/Spinner.ts","../src/feedback/Scrollbar.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';\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';\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// ── Feedback Widgets ──────────────────────────────────\nexport { ProgressBar } from './feedback/ProgressBar.js';\nexport type { ProgressBarOptions } from './feedback/ProgressBar.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';\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 }\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 — List widget (selectable)\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, stringWidth, truncate } 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 ? '▸ ' : ' ';\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 ? '█' : '░';\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 } from '@termuijs/core';\nimport { Widget } from '../base/Widget.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 startIdx = Math.max(0, this._scrollOffset - this._overscan);\n const endIdx = Math.min(this._totalItems, this._scrollOffset + visibleItemCount + this._overscan);\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 ? '▸ ' : ' ';\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\n for (let r = 0; r < height; r++) {\n const scrollChar = r === thumbPos ? '█' : '░';\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 — 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 } 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 ? '█' : '░';\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 } 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// Braille sparkline characters (8 levels per cell, bottom to top)\nconst SPARK_CHARS = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];\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 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: SPARK_CHARS[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 — ProgressBar widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type Color } 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 ?? '█';\n this._emptyChar = options.emptyChar ?? '░';\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 — Spinner widget\n// ─────────────────────────────────────────────────────\n\nimport { type Screen, type Style, styleToCellAttrs, type Color } from '@termuijs/core';\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\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\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 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 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,UAAM,cAAc,KAAK;AAAA,MACrB,cAAc;AAAA,MACd,KAAK,MAAO,KAAK,aAAa,cAAc,aAAc,SAAS;AAAA,IACvE;AAGA,aAAS,IAAI,GAAG,IAAI,aAAa,KAAK;AAClC,YAAM,MAAM,aAAa;AACzB,YAAM,QAAQ,WAAW,SAAS,IAAI;AACtC,YAAM,QAAQ,WAAW,IAAI,MAAM;AAEnC,YAAM,UAAU,KAAK,eAAe,IAAI,cAAc;AAEtD,aAAO,QAAQ,OAAO,OAAO;AAAA,QACzB,MAAM,UAAU,QAAQ,QAAQ,QAAQ;AAAA,QACxC,IAAI,UAAU,KAAK,cAAc,KAAK;AAAA,MAC1C,CAAC;AAAA,IACL;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"]}
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 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;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,kBAeO;AAcP,IAAI,mBAAmB;AAmBhB,IAAe,SAAf,MAAsB;AAAA;AAAA,EAEhB;AAAA;AAAA,EAGC;AAAA;AAAA,EAGA,YAAsB,CAAC;AAAA;AAAA,EAGjC,SAAwB;AAAA;AAAA,EAGd,QAAc,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE;AAAA;AAAA,EAGlD,cAAiC;AAAA;AAAA,EAGzC,YAAY;AAAA;AAAA,EAGZ,WAAW;AAAA;AAAA,EAGF,SAAS,IAAI,yBAA2B;AAAA;AAAA,EAGjD,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,EAMF,SAAS;AAAA,EAEnB,YAAY,QAAwB,CAAC,GAAG;AACpC,SAAK,KAAK,UAAU,EAAE,gBAAgB;AACtC,SAAK,aAAS,6BAAY,0BAAa,GAAG,KAAK;AAAA,EACnD;AAAA;AAAA,EAGA,IAAI,QAAe;AAAE,WAAO,KAAK;AAAA,EAAQ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AU;AAAA,EACnB;AAAA,EAEU,YAAY,QAAsB;AACxC,UAAM,OAAO,KAAK,gBAAgB;AAClC,UAAM,EAAE,GAAG,GAAG,MAAM,IAAI;AACxB,QAAI,SAAS,KAAK,CAAC,KAAK,MAAO;AAE/B,UAAM,YAAQ,gCAAiB,KAAK,MAAM;AAG1C,QAAI,CAAC,mBAAK,OAAO;AACb,aAAO,YAAY,GAAG,GAAG,KAAK,MAAM,MAAM,GAAG,KAAK,GAAG,KAAK;AAC1D;AAAA,IACJ;AAEA,UAAM,WAAW,SAAS,KAAK,WAAW;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"]}