-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ts
65 lines (58 loc) · 1.19 KB
/
test.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
55
56
57
58
59
60
61
62
63
64
import nd from './index.js'
const scr = new nd.Screen();
const el = new nd.Box({
fg: 'red',
bg: 'green',
bold: true,
underline: true,
content: `{center}{magenta-fg}hello {/bold}world{/magenta-fg}{/center}\n{left}{blue-bg}left{/blue-bg}{/left}\n{right}right{/right}\n{red-bg}left seperator{|}right seperator{/red-bg}${'\n'.repeat(50)}hi`,
screen: scr,
width: '50%',
height: '50%',
left: '0%',
top: '0%',
label: 'test box',
border: {
type: 'line'
},
style: {
hover: {
bg: 'brown'
}
}
});
const ln = new nd.Line({
screen: scr,
orientation: 'v',
height: '100%',
top: 0,
left: '50%',
lineType: 'double'
});
ln.focus();
new nd.Element({
fg: 'black',
bg: 'blue',
content: 'left─sep─era─tor{|}right seperator{/red-bg}',
screen: scr,
width: '50%',
height: '50%',
left: '20%',
top: '20%',
border: {
type: 'line',
lineType: 'double'
}
});
scr.render();
scr.key(['esc*', 'q', 'C-c'], () => {
process.exit();
});
el.key('h', () => {
el.height = '40%';
scr.render();
});
el.key('u', () => {
el.height = '50%';
scr.render();
});