@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
26 lines • 963 B
JavaScript
import { nextRenderRevision } from "@earendil-works/pi-tui";
import { theme } from "../theme/theme.js";
/**
* Dynamic border component that adjusts to viewport width.
*
* Note: When used from extensions loaded via jiti, the global `theme` may be undefined
* because jiti creates a separate module cache. Always pass an explicit color
* function when using DynamicBorder in components exported for extension use.
*/
export class DynamicBorder {
constructor(color = (str) => theme.fg("border", str)) {
this.revision = nextRenderRevision();
this.color = color;
}
invalidate() {
this.revision = nextRenderRevision();
}
/** A full-width rule in a fixed color function: only the width (and theme, via invalidate) varies. */
getRenderRevision() {
return this.revision;
}
render(width) {
return [this.color("─".repeat(Math.max(1, width)))];
}
}
//# sourceMappingURL=dynamic-border.js.map