Something went wrong. Try again.
more up to date at codeberg https://codeberg.org/cowie/tau.git
Something went wrong. Try again.
786 B · 25 lines
TypeScript
at main
1234567891011121314151617181920212223242526import type { Component } from "@earendil-works/pi-tui";import { theme } from "../theme/theme.ts";
/** * 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 implements Component { private color: (str: string) => string;
constructor(color: (str: string) => string = (str) => theme.fg("border", str)) { this.color = color; }
invalidate(): void { // No cached state to invalidate currently }
render(width: number): string[] { return [this.color("─".repeat(Math.max(1, width)))]; }}