@zakmandhro/bunti 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zak Mandhro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # 🥟 Bunti (Bun Terminal Interface)
2
+
3
+ **A high-performance, functional TUI engine built specifically for Bun.**
4
+
5
+ Bunti (pronounced *Bun-ty*) is a zero-dependency, double-buffered layout engine for building terminal user interfaces. Unlike traditional TUI libraries, Bunti uses a **functional, state-driven architecture** and a **surgical diff-renderer** to deliver 60+ FPS layouts with minimal CPU and TTY overhead.
6
+
7
+ ## ✨ Features
8
+
9
+ - 🏗️ **Contextual DSL**: Build complex UIs with a declarative, nested closure API.
10
+ - 🏎️ **Double-Buffered Diffing**: Only dirty row spans are sent to the terminal. Zero flicker.
11
+ - 📏 **Mathematically Absolute**: 100% precision in width, padding, and border alignment.
12
+ - 📐 **Tactical Standard**: Opinionated border styles (`default`, `rounded`, `frame`, `thick-frame`).
13
+ - 🌈 **24-bit TrueColor**: High-fidelity RGB gradients with native hex parsing and relative contrast.
14
+ - 🖱️ **Interactive**: Built-in SGR mouse tracking and focus detection with automatic FPS throttling.
15
+
16
+ ## 📦 Installation
17
+
18
+ Bunti is designed for Bun, but works in standard Node.js environments (v18+) as well.
19
+
20
+ ```bash
21
+ bun add @zakmandhro/bunti
22
+ ```
23
+
24
+ Or using npm/pnpm/yarn:
25
+
26
+ ```bash
27
+ npm install @zakmandhro/bunti
28
+ ```
29
+
30
+ ## 🚀 Quick Start
31
+
32
+ ```typescript
33
+ import { bunti } from '@zakmandhro/bunti';
34
+
35
+ bunti.render(({ wallpaper, box, color, icon, span }) => {
36
+ // 1. Set a dynamic gradient background
37
+ wallpaper(bunti.gradient({ colors: ['midnight', 'plasma'] }));
38
+
39
+ // 2. Define a centered high-contrast card
40
+ box({
41
+ size: "auto",
42
+ bgColor: "white",
43
+ color: "blank", // Automatic high-contrast black
44
+ border: 'frame' // Tactical block border
45
+ }, ({ text }) => {
46
+ text(` ${icon('rocket')} `);
47
+ text(color.bold("MISSION CONTROL\n\n"));
48
+
49
+ span({ color: color.dim }, ({ text }) => {
50
+ text("STATUS: ");
51
+ });
52
+ text("NOMINAL");
53
+ });
54
+ }, { fps: 60, mouse: true });
55
+ ```
56
+
57
+ ## 📐 Border Archetypes
58
+
59
+ Bunti categorizes containers into three visual archetypes:
60
+
61
+ | Category | Styles | Description |
62
+ | :--- | :--- | :--- |
63
+ | **Wireframe** | `default`, `rounded`, `double`, `dashed`, `dotted` | Clean, 1-width lines. Zero visual mass. |
64
+ | **Frame** | `frame`, `thick-frame` | Block-based containers. High physical presence. |
65
+ | **Ghost** | `none` | Purely structural containers for grouping and alignment. |
66
+
67
+ ## 🏁 Performance
68
+
69
+ Bunti is built for speed. By leveraging `Bun.stdout.writer()` and surgical diffing, it can maintain **60-120 FPS** on complex layouts while keeping TTY bytes significantly lower than standard stream-based libraries.
70
+
71
+ ## 🛠️ Tooling
72
+
73
+ ### TSGO (High-Performance TypeScript)
74
+ Bunti uses **[tsgo](https://github.com/d-ts/tsgo)** for its type-checking pipeline.
75
+
76
+ We chose `tsgo` over the standard `tsc` because:
77
+ - **Speed**: It leverages a Go-based core to provide near-instant feedback during development.
78
+ - **Agent-Friendly**: Its predictable and high-performance output makes it ideal for automated engineering workflows.
79
+ - **Strict Integrity**: It ensures that Bunti's functional architecture remains 100% type-safe without the overhead of standard Node-based compilers.
80
+
81
+ Run a full check with: `npm run type-check`
82
+
83
+ ## 📚 Documentation
84
+
85
+ Dive deeper into Bunti's architecture and layout engine:
86
+
87
+ - [The Box Model & Layout Math](./docs/layout.md)
88
+ - [Bunti Components & Primitives](./docs/components.md)
89
+ - [Bunti vs. The TUI Ecosystem](./docs/comparison.md)
90
+
91
+ ## 🤝 Contributing
92
+
93
+ Contributions are welcome! Please feel free to submit a Pull Request. Since Bunti prioritizes mathematical precision and performance, please ensure you run the benchmark and type-check scripts before submitting.
94
+
95
+ ```bash
96
+ bun run lint
97
+ bun run typecheck
98
+ bun run test
99
+ bun run bench
100
+ ```
101
+
102
+ ## 📄 License
103
+
104
+ MIT © Zak Mandhro
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@zakmandhro/bunti",
3
+ "version": "0.1.0",
4
+ "description": "Bun Terminal Interface (bunti) - A minimalist, utility-first terminal layout engine built for Bun.",
5
+ "module": "src/index.ts",
6
+ "exports": {
7
+ ".": "./src/index.ts",
8
+ "./components": "./src/components/index.ts",
9
+ "./icons": "./src/icons.ts",
10
+ "./layout": "./src/layout.ts",
11
+ "./render": "./src/render.ts"
12
+ },
13
+ "type": "module",
14
+ "engines": {
15
+ "bun": ">=1.0.0"
16
+ },
17
+ "scripts": {
18
+ "test": "bun test",
19
+ "bench": "bun scripts/bench.ts",
20
+ "typecheck": "tsc --noEmit",
21
+ "type-check": "tsc --noEmit",
22
+ "lint": "biome check .",
23
+ "lint:fix": "biome check --write .",
24
+ "format": "biome format --write .",
25
+ "demo": "bun demo/runner.ts",
26
+ "example": "bun demo/runner.ts",
27
+ "docs:dev": "vitepress dev docs",
28
+ "docs:build": "vitepress build docs",
29
+ "docs:preview": "vitepress preview docs"
30
+ },
31
+ "keywords": [
32
+ "tui",
33
+ "cli",
34
+ "terminal",
35
+ "layout",
36
+ "bun",
37
+ "bunti"
38
+ ],
39
+ "author": "Zak Mandhro <zakmandhro@gmail.com>",
40
+ "license": "MIT",
41
+ "files": [
42
+ "src"
43
+ ],
44
+ "peerDependencies": {
45
+ "picocolors": "^1.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@biomejs/biome": "^2.4.15",
49
+ "@types/bun": "^1.3.13",
50
+ "@types/node": "^25.6.2",
51
+ "typescript": "^5.4.0",
52
+ "vitepress": "^1.6.4"
53
+ }
54
+ }
package/src/colors.ts ADDED
@@ -0,0 +1,255 @@
1
+ /**
2
+ * Bunti Semantic & Palette Color System
3
+ */
4
+
5
+ import type { RGB } from './state';
6
+
7
+ export interface Gradient {
8
+ colors: RGB[];
9
+ direction: 'vertical' | 'horizontal';
10
+ steps: number;
11
+ }
12
+
13
+ export const PALETTE = {
14
+ // Greyscale
15
+ slate: '235',
16
+ ash: '240',
17
+ gray: '244',
18
+ silver: '247',
19
+ white: '255',
20
+ black: '0',
21
+
22
+ // Deep Blues & Space
23
+ midnight: '17',
24
+ ocean: '24',
25
+ sky: '33',
26
+ 'bunti-blue': '38',
27
+ 'deep-navy': '17',
28
+ nebula: '61',
29
+ plasma: '165',
30
+
31
+ // Semantic
32
+ success: '40',
33
+ warning: '214',
34
+ error: '196',
35
+ info: '39',
36
+
37
+ // Accents
38
+ gold: '220',
39
+ rose: '211',
40
+ mint: '121',
41
+ } as const;
42
+
43
+ const RGB_REGISTRY: Record<string, RGB> = {
44
+ black: { r: 0, g: 0, b: 0 },
45
+ red: { r: 200, g: 50, b: 50 },
46
+ green: { r: 50, g: 200, b: 50 },
47
+ yellow: { r: 200, g: 200, b: 50 },
48
+ blue: { r: 50, g: 50, b: 200 },
49
+ magenta: { r: 200, g: 50, b: 200 },
50
+ cyan: { r: 50, g: 200, b: 200 },
51
+ white: { r: 255, g: 255, b: 255 },
52
+ gray: { r: 128, g: 128, b: 128 },
53
+ // Greyscale
54
+ slate: { r: 40, g: 44, b: 52 },
55
+ ash: { r: 75, g: 82, b: 99 },
56
+ silver: { r: 188, g: 192, b: 204 },
57
+ // Deep Blues & Space
58
+ midnight: { r: 15, g: 15, b: 35 },
59
+ ocean: { r: 20, g: 40, b: 80 },
60
+ sky: { r: 0, g: 135, b: 255 },
61
+ 'bunti-blue': { r: 59, g: 188, b: 225 },
62
+ 'deep-navy': { r: 0, g: 51, b: 102 },
63
+ nebula: { r: 95, g: 95, b: 175 },
64
+ plasma: { r: 201, g: 0, b: 255 },
65
+ // Semantic
66
+ success: { r: 0, g: 215, b: 0 },
67
+ warning: { r: 255, g: 175, b: 0 },
68
+ error: { r: 215, g: 0, b: 0 },
69
+ info: { r: 0, g: 175, b: 255 },
70
+ // Accents
71
+ gold: { r: 255, g: 215, b: 0 },
72
+ rose: { r: 255, g: 175, b: 175 },
73
+ mint: { r: 175, g: 255, b: 175 },
74
+ };
75
+
76
+ // Map standard names to ANSI-256 for basic compat
77
+ const NAME_TO_ANSI: Record<string, string> = {
78
+ red: '160',
79
+ green: '40',
80
+ yellow: '220',
81
+ blue: '33',
82
+ magenta: '165',
83
+ cyan: '39',
84
+ white: '255',
85
+ black: '0',
86
+ gray: '244',
87
+ };
88
+
89
+ export type PaletteColor = keyof typeof PALETTE;
90
+
91
+ /**
92
+ * Parses a hex color string (#RRGGBB or #RGB) to an RGB object.
93
+ */
94
+ export function hexToRGB(hex: string): RGB {
95
+ const h = hex.replace('#', '');
96
+ if (h.length === 3) {
97
+ return {
98
+ r: parseInt(h[0] + h[0], 16),
99
+ g: parseInt(h[1] + h[1], 16),
100
+ b: parseInt(h[2] + h[2], 16),
101
+ };
102
+ }
103
+ return {
104
+ r: parseInt(h.substring(0, 2), 16),
105
+ g: parseInt(h.substring(2, 4), 16),
106
+ b: parseInt(h.substring(4, 6), 16),
107
+ };
108
+ }
109
+
110
+ /**
111
+ * Resolves a palette name, color code, or RGB object to a string for ANSI.
112
+ */
113
+ export function resolveColor(
114
+ color: PaletteColor | string | number | RGB,
115
+ ): string | number {
116
+ if (typeof color === 'object' && 'r' in color) {
117
+ return `2;${color.r};${color.g};${color.b}`;
118
+ }
119
+ if (typeof color === 'string') {
120
+ if (color.startsWith('#')) {
121
+ const rgb = hexToRGB(color);
122
+ return `2;${rgb.r};${rgb.g};${rgb.b}`;
123
+ }
124
+ return (PALETTE as any)[color] || NAME_TO_ANSI[color] || color;
125
+ }
126
+ return color;
127
+ }
128
+
129
+ /**
130
+ * Creates a multi-stop gradient (array of RGB objects) between multiple colors.
131
+ */
132
+ export function createGradient(
133
+ arg1: (string | number | RGB)[] | string | number | RGB,
134
+ arg2?: string | number | RGB | number,
135
+ arg3?: number,
136
+ ): RGB[] {
137
+ let colors: (string | number | RGB)[] = [];
138
+ let steps = 5;
139
+
140
+ if (Array.isArray(arg1)) {
141
+ colors = arg1;
142
+ steps = typeof arg2 === 'number' ? arg2 : 5;
143
+ } else if (arg1 && arg2) {
144
+ colors = [arg1, arg2 as any];
145
+ steps = typeof arg3 === 'number' ? arg3 : 5;
146
+ }
147
+
148
+ if (colors.length === 0) return [];
149
+ if (colors.length === 1)
150
+ return Array(steps).fill(resolveColorToRGB(colors[0]));
151
+ if (steps <= 1) return [resolveColorToRGB(colors[0])];
152
+
153
+ const result: RGB[] = [];
154
+ const rgbColors = colors.map(resolveColorToRGB);
155
+
156
+ for (let i = 0; i < steps; i++) {
157
+ const globalT = i / (steps - 1);
158
+ const segmentCount = rgbColors.length - 1;
159
+ const segmentIdx = Math.min(
160
+ Math.floor(globalT * segmentCount),
161
+ segmentCount - 1,
162
+ );
163
+
164
+ const start = rgbColors[segmentIdx];
165
+ const end = rgbColors[segmentIdx + 1];
166
+ const t = globalT * segmentCount - segmentIdx;
167
+
168
+ result.push({
169
+ r: Math.round(start.r + (end.r - start.r) * t),
170
+ g: Math.round(start.g + (end.g - start.g) * t),
171
+ b: Math.round(start.b + (end.b - start.b) * t),
172
+ });
173
+ }
174
+
175
+ return result;
176
+ }
177
+
178
+ /**
179
+ * Helper to resolve any color type to an RGB object.
180
+ */
181
+ function resolveColorToRGB(color: any): RGB {
182
+ if (typeof color === 'object' && 'r' in color) return color;
183
+ if (typeof color === 'string' && color.startsWith('#'))
184
+ return hexToRGB(color);
185
+
186
+ // 1. Check registry
187
+ if (typeof color === 'string' && RGB_REGISTRY[color])
188
+ return RGB_REGISTRY[color];
189
+
190
+ // 2. Check Palette
191
+ const paletteValue = (PALETTE as any)[color];
192
+ if (paletteValue) {
193
+ // If palette value is a name, look it up in registry
194
+ const registered = RGB_REGISTRY[color];
195
+ if (registered) return registered;
196
+ }
197
+
198
+ // Fallback
199
+ return { r: 128, g: 128, b: 128 };
200
+ }
201
+
202
+ /**
203
+ * Adjusts the brightness of a color.
204
+ */
205
+ export function adjustBrightness(color: any, amount: number): RGB {
206
+ const rgb = resolveColorToRGB(color);
207
+ const factor = 1 + amount / 100;
208
+ return {
209
+ r: Math.max(0, Math.min(255, Math.round(rgb.r * factor))),
210
+ g: Math.max(0, Math.min(255, Math.round(rgb.g * factor))),
211
+ b: Math.max(0, Math.min(255, Math.round(rgb.b * factor))),
212
+ };
213
+ }
214
+
215
+ /**
216
+ * Returns a function that darkens a color and can be used as a style wrapper.
217
+ */
218
+ export function darken(color: any, amount: number = 20) {
219
+ const adjusted = adjustBrightness(color, -amount);
220
+ return (text: string) => fg(adjusted, text);
221
+ }
222
+
223
+ /**
224
+ * Returns a function that lightens a color and can be used as a style wrapper.
225
+ */
226
+ export function lighten(color: any, amount: number = 20) {
227
+ const adjusted = adjustBrightness(color, amount);
228
+ return (text: string) => fg(adjusted, text);
229
+ }
230
+
231
+ /**
232
+ * Returns an RGB object for TrueColor rendering.
233
+ */
234
+ export function rgb(r: number, g: number, b: number) {
235
+ return { r, g, b };
236
+ }
237
+
238
+ /**
239
+ * Returns an ANSI escape sequence for a color.
240
+ */
241
+ export function fg(color: any, text: string): string {
242
+ const code = resolveColor(color);
243
+ const codeStr = String(code);
244
+ const prefix =
245
+ typeof color === 'object' || codeStr.startsWith('2;') ? '38' : '38;5';
246
+ return `\x1b[${prefix};${codeStr}m${text}\x1b[0m`;
247
+ }
248
+
249
+ export function bg(color: any, text: string): string {
250
+ const code = resolveColor(color);
251
+ const codeStr = String(code);
252
+ const prefix =
253
+ typeof color === 'object' || codeStr.startsWith('2;') ? '48' : '48;5';
254
+ return `\x1b[${prefix};${codeStr}m${text}\x1b[0m`;
255
+ }
@@ -0,0 +1,104 @@
1
+ import type { BuntiContext } from '../dsl';
2
+ import type { StyleOptions } from '../layout';
3
+
4
+ export interface ButtonProps extends StyleOptions {
5
+ id: string;
6
+ label: string;
7
+ icon?: string;
8
+ variant?: 'primary' | 'secondary' | 'danger';
9
+ onClick?: () => void;
10
+ }
11
+
12
+ /**
13
+ * Tactical Button Component
14
+ * Fully reactive to keyboard focus and action events.
15
+ */
16
+ export function Button(ctx: BuntiContext, props: ButtonProps) {
17
+ const {
18
+ box,
19
+ color,
20
+ focusable,
21
+ state,
22
+ offsetX,
23
+ offsetY,
24
+ mouseX,
25
+ mouseY,
26
+ isMouseDown,
27
+ } = ctx;
28
+
29
+ // 1. Register in the global focus loop (for TAB navigation)
30
+ const isSelected = focusable(props.id);
31
+
32
+ // 2. Resolve final dimensions to perform Mouse Hit-Testing
33
+ const finalLabel = props.icon ? `${props.icon} ${props.label}` : props.label;
34
+ const w = props.width || Math.max(12, finalLabel.length + 4);
35
+ const h = props.height || 3;
36
+
37
+ const resolvedW = typeof w === 'number' ? w : ctx.width;
38
+ const absX =
39
+ props.width === '100%'
40
+ ? offsetX
41
+ : offsetX + Math.max(0, Math.floor((ctx.width - resolvedW) / 2));
42
+ const absY = offsetY + ctx.cursorY;
43
+
44
+ const isHovered =
45
+ mouseX >= absX &&
46
+ mouseX < absX + resolvedW &&
47
+ mouseY >= absY &&
48
+ mouseY < absY + (h as number);
49
+
50
+ // 3. Resolve Theme & State
51
+ let bg: any = 254; // Near white
52
+ let fg: any = 'black';
53
+ let borderCol: any = { r: 217, g: 216, b: 213 };
54
+
55
+ if (props.variant === 'primary') {
56
+ bg = 'black';
57
+ fg = 'white';
58
+ borderCol = 'black';
59
+ } else if (props.variant === 'danger') {
60
+ bg = 'error';
61
+ borderCol = color.lighten('error', 20);
62
+ fg = 'white';
63
+ }
64
+
65
+ // Active Interactive State
66
+ const isActive = isSelected || isHovered;
67
+
68
+ if (isActive) {
69
+ if (props.variant === 'primary') {
70
+ bg = 'ash'; // Hover state for primary
71
+ } else {
72
+ borderCol = 'black';
73
+ if (isMouseDown && isHovered) {
74
+ bg = color.darken(bg, 5); // Pressed state
75
+ }
76
+ }
77
+ }
78
+
79
+ // 4. Handle Interaction
80
+ const wasClicked = isHovered && isMouseDown && state.mouseButton === 0;
81
+ const wasActivated =
82
+ isSelected && (state.lastKey === 'enter' || state.lastKey === ' ');
83
+
84
+ if (wasClicked || wasActivated) {
85
+ if (props.onClick) props.onClick();
86
+ }
87
+
88
+ // 5. Render the Primitive
89
+ return box(
90
+ {
91
+ width: w,
92
+ height: h,
93
+ border: props.variant === 'primary' ? 'none' : props.border || 'rounded',
94
+ borderColor: borderCol,
95
+ bgColor: bg,
96
+ align: props.align || 'center',
97
+ valign: props.valign || 'middle',
98
+ padding: props.padding || [0, 1],
99
+ },
100
+ ({ text }) => {
101
+ text(color.fg(fg, isActive ? color.bold(finalLabel) : finalLabel));
102
+ },
103
+ );
104
+ }
@@ -0,0 +1,53 @@
1
+ import type { BuntiContext, DSLBoxOptions } from '../dsl';
2
+
3
+ export interface CardProps extends DSLBoxOptions {
4
+ title?: string;
5
+ theme?: 'default' | 'accent' | 'danger';
6
+ }
7
+
8
+ /**
9
+ * Tactical Card Component
10
+ * A structural container with an integrated header.
11
+ */
12
+ export function Card(
13
+ ctx: BuntiContext,
14
+ props: CardProps,
15
+ callback: (sub: BuntiContext) => void,
16
+ ) {
17
+ const { box, color } = ctx;
18
+
19
+ const neutralGray = { r: 217, g: 216, b: 213 };
20
+ let borderColor: any = neutralGray;
21
+ let titleColor: any = neutralGray;
22
+
23
+ if (props.theme === 'accent') {
24
+ titleColor = 'black';
25
+ // Border remains neutral gray
26
+ } else if (props.theme === 'danger') {
27
+ borderColor = 'error';
28
+ titleColor = 'error';
29
+ }
30
+
31
+ return box(
32
+ {
33
+ x: props.x,
34
+ y: props.y,
35
+ anchor: props.anchor,
36
+ width: props.width || '100%',
37
+ height: props.height,
38
+ minHeight: props.minHeight,
39
+ border: props.border || 'frame',
40
+ borderColor: props.borderColor || borderColor,
41
+ padding: props.padding || [1, 2],
42
+ bgColor: props.bgColor,
43
+ },
44
+ (sub) => {
45
+ if (props.title) {
46
+ sub.text(
47
+ color.fg(titleColor, color.bold(`${props.title.toUpperCase()}\n\n`)),
48
+ );
49
+ }
50
+ callback(sub);
51
+ },
52
+ );
53
+ }
@@ -0,0 +1,65 @@
1
+ import type { BuntiContext } from '../dsl';
2
+ import { box as engineBox } from '../layout';
3
+
4
+ export interface HeaderProps {
5
+ title: string;
6
+ leftIcon?: string;
7
+ rightLabel?: string;
8
+ theme?: 'light' | 'dark';
9
+ }
10
+
11
+ /**
12
+ * Enterprise Tactical Header
13
+ * A full-width, high-signal branding bar.
14
+ */
15
+ export function Header(ctx: BuntiContext, props: HeaderProps) {
16
+ const { box, color, width, joinHorizontal } = ctx;
17
+
18
+ // Resolve Theme Colors
19
+ const isLight = props.theme !== 'dark';
20
+ const bg = isLight ? 'white' : 'midnight';
21
+ const fg = isLight ? 236 : 'silver';
22
+
23
+ // Master Background Box
24
+ box(
25
+ {
26
+ anchor: 'top',
27
+ width: '100%',
28
+ height: 1,
29
+ bgColor: bg,
30
+ border: 'none',
31
+ padding: [0, 2],
32
+ },
33
+ ({ text }) => {
34
+ // 1. Left: Branding
35
+ const leftStr = props.leftIcon ? color.fg('plasma', props.leftIcon) : '';
36
+ const leftNode = engineBox(leftStr, {
37
+ width: 12,
38
+ align: 'left',
39
+ border: 'none',
40
+ padding: [0, 0],
41
+ });
42
+
43
+ // 2. Center: Title
44
+ const midStr = color.fg(fg, color.bold(props.title));
45
+ const midNode = engineBox(midStr, {
46
+ width: width - 28,
47
+ align: 'center',
48
+ border: 'none',
49
+ padding: [0, 0],
50
+ });
51
+
52
+ // 3. Right: Telemetry / Exit
53
+ const rightStr = props.rightLabel ? color.dim(props.rightLabel) : '';
54
+ const rightNode = engineBox(rightStr, {
55
+ width: 12,
56
+ align: 'right',
57
+ border: 'none',
58
+ padding: [0, 0],
59
+ });
60
+
61
+ // Join and push to render pipeline
62
+ text(joinHorizontal(leftNode, midNode, rightNode));
63
+ },
64
+ );
65
+ }