- Removed Prettier configuration files (.prettierignore and .prettierrc) and migrated formatting to Biome. - Updated Biome configuration from version 2.3.11 to 2.3.12 and changed arrowParentheses rule from 'always' to 'asNeeded'. - Pinned @biomejs/biome dependency to exact version 2.3.12 in package.json and bun.lock. - Applied consistent arrow function formatting across 489 files by removing unnecessary parentheses around single parameters. - Removed blank lines after comment blocks and reorganized imports for consistency across the codebase.
26 lines
794 B
TypeScript
26 lines
794 B
TypeScript
import type { Component } from "@oh-my-pi/pi-tui";
|
|
import { theme } from "../../modes/theme/theme";
|
|
|
|
/**
|
|
* Dynamic border component that adjusts to viewport width.
|
|
*
|
|
* Note: When used from hooks 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 hook 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(theme.boxSharp.horizontal.repeat(Math.max(1, width)))];
|
|
}
|
|
}
|