-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.ts
54 lines (47 loc) · 1.48 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import * as utils from './utils';
import * as borderModule from './border';
import * as boxModule from './box';
import * as matrixModule from './matrix';
import * as rectangleModule from './rectangle';
export type BorderType = 'default';
export type Borders = borderModule.Borders;
export type Box = boxModule.Box;
export type Coordinate = utils.Coordinate;
export type ElementBody = matrixModule.ElementBody;
export type Rectangle = rectangleModule.Rectangle;
export type Size = utils.Size;
export type SymbolRuler = matrixModule.SymbolRuler;
export const createBox = boxModule.createBox;
export const createElementBody = matrixModule.createElementBody;
export const render = boxModule.renderBox;
export function getWidth(box: Box): number {
return matrixModule.getWidth(box.matrix);
}
export function getHeight(box: Box): number {
return matrixModule.getHeight(box.matrix);
}
export function getMaxX(box: Box): number {
return matrixModule.getMaxX(box.matrix);
}
export function getMaxY(box: Box): number {
return matrixModule.getMaxY(box.matrix);
}
export function createBordersByType(borderType: BorderType): Borders {
switch (borderType) {
case 'default':
return {
topWidth: 1,
bottomWidth: 1,
leftWidth: 1,
rightWidth: 1,
topSymbols: ['-'],
bottomSymbols: ['-'],
leftSymbols: ['|'],
rightSymbols: ['|'],
topLeftSymbols: ['+'],
topRightSymbols: ['+'],
bottomLeftSymbols: ['+'],
bottomRightSymbols: ['+'],
};
}
}