CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
index.d.ts268 linesDownload Raw Back to boxen
1import {type LiteralUnion} from 'type-fest';2import {type BoxStyle, type Boxes as CLIBoxes} from 'cli-boxes';3 4/**5All box styles.6*/7type Boxes = {8	readonly none: BoxStyle;9} & CLIBoxes;10 11/**12Characters used for custom border.13 14@example15```16// attttb17// l    r18// dbbbbc19 20const border: CustomBorderStyle = {21	topLeft: 'a',22	topRight: 'b',23	bottomRight: 'c',24	bottomLeft: 'd',25	left: 'l',26	right: 'r',27	top: 't',28	bottom: 'b',29};30```31*/32export type CustomBorderStyle = {33	/**34	@deprecated Use `top` and `bottom` instead.35	*/36	horizontal?: string;37 38	/**39	@deprecated Use `left` and `right` instead.40	*/41	vertical?: string;42} & BoxStyle;43 44/**45Spacing used for `padding` and `margin`.46*/47export type Spacing = {48	readonly top?: number;49	readonly right?: number;50	readonly bottom?: number;51	readonly left?: number;52};53 54export type Options = {55	/**56	Color of the box border.57	*/58	readonly borderColor?: LiteralUnion<59	| 'black'60	| 'red'61	| 'green'62	| 'yellow'63	| 'blue'64	| 'magenta'65	| 'cyan'66	| 'white'67	| 'gray'68	| 'grey'69	| 'blackBright'70	| 'redBright'71	| 'greenBright'72	| 'yellowBright'73	| 'blueBright'74	| 'magentaBright'75	| 'cyanBright'76	| 'whiteBright',77	string78	>;79 80	/**81	Style of the box border.82 83	@default 'single'84	*/85	readonly borderStyle?: keyof Boxes | CustomBorderStyle;86 87	/**88	Reduce opacity of the border.89 90	@default false91	*/92	readonly dimBorder?: boolean;93 94	/**95	Space between the text and box border.96 97	@default 098	*/99	readonly padding?: number | Spacing;100 101	/**102	Space around the box.103 104	@default 0105	*/106	readonly margin?: number | Spacing;107 108	/**109	Float the box on the available terminal screen space.110 111	@default 'left'112	*/113	readonly float?: 'left' | 'right' | 'center';114 115	/**116	Color of the background.117	*/118	readonly backgroundColor?: LiteralUnion<119	| 'black'120	| 'red'121	| 'green'122	| 'yellow'123	| 'blue'124	| 'magenta'125	| 'cyan'126	| 'white'127	| 'blackBright'128	| 'redBright'129	| 'greenBright'130	| 'yellowBright'131	| 'blueBright'132	| 'magentaBright'133	| 'cyanBright'134	| 'whiteBright',135	string136	>;137 138	/**139	Align the text in the box based on the widest line.140 141	@default 'left'142	@deprecated Use `textAlignment` instead.143	*/144	readonly align?: 'left' | 'right' | 'center';145 146	/**147	Align the text in the box based on the widest line.148 149	@default 'left'150	*/151	readonly textAlignment?: 'left' | 'right' | 'center';152 153	/**154	Display a title at the top of the box.155	If needed, the box will horizontally expand to fit the title.156 157	@example158	```159	console.log(boxen('foo bar', {title: 'example'}));160	// ┌ example ┐161	// │foo bar  │162	// └─────────┘163	```164	*/165	readonly title?: string;166 167	/**168	Align the title in the top bar.169 170	@default 'left'171 172	@example173	```174	console.log(boxen('foo bar foo bar', {title: 'example', titleAlignment: 'center'}));175	// ┌─── example ───┐176	// │foo bar foo bar│177	// └───────────────┘178 179	console.log(boxen('foo bar foo bar', {title: 'example', titleAlignment: 'right'}));180	// ┌────── example ┐181	// │foo bar foo bar│182	// └───────────────┘183	```184	*/185	readonly titleAlignment?: 'left' | 'right' | 'center';186 187	/**188	Set a fixed width for the box.189 190	__Note__: This disables terminal overflow handling and may cause the box to look broken if the user's terminal is not wide enough.191 192	@example193	```194	import boxen from 'boxen';195 196	console.log(boxen('foo bar', {width: 15}));197	// ┌─────────────┐198	// │foo bar      │199	// └─────────────┘200	```201	*/202	readonly width?: number;203 204	/**205	Set a fixed height for the box.206 207	__Note__: This option will crop overflowing content.208 209	@example210	```211	import boxen from 'boxen';212 213	console.log(boxen('foo bar', {height: 5}));214	// ┌───────┐215	// │foo bar│216	// │       │217	// │       │218	// └───────┘219	```220	*/221	readonly height?: number;222 223	/**224	__boolean__: Whether or not to fit all available space within the terminal.225 226	__function__: Pass a callback function to control box dimensions.227 228	@example229	```230	import boxen from 'boxen';231 232	console.log(boxen('foo bar', {233		fullscreen: (width, height) => [width, height - 1],234	}));235	```236	*/237	readonly fullscreen?: boolean | ((width: number, height: number) => [width: number, height: number]);238};239 240/**241Creates a box in the terminal.242 243@param text - The text inside the box.244@returns The box.245 246@example247```248import boxen from 'boxen';249 250console.log(boxen('unicorn', {padding: 1}));251// ┌─────────────┐252// │             │253// │   unicorn   │254// │             │255// └─────────────┘256 257console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));258//259// ╔═════════════╗260// ║             ║261// ║   unicorn   ║262// ║             ║263// ╚═════════════╝264//265```266*/267export default function boxen(text: string, options?: Options): string;268 
basant307/AI_Governance_Project · CoolFace