@suds-cli/statusbar 0.1.0-alpha.0 → 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/dist/index.cjs +162 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{model.d.ts → index.d.cts} +16 -5
- package/dist/index.d.ts +77 -3
- package/dist/index.js +158 -1
- package/dist/index.js.map +1 -1
- package/package.json +28 -15
- package/dist/index.d.ts.map +0 -1
- package/dist/model.d.ts.map +0 -1
- package/dist/model.js +0 -179
- package/dist/model.js.map +0 -1
- package/dist/types.d.ts +0 -26
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -19,33 +19,33 @@ pnpm add @suds-cli/statusbar
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import { StatusbarModel } from
|
|
23
|
-
import type { ColorConfig } from
|
|
22
|
+
import { StatusbarModel } from '@suds-cli/statusbar'
|
|
23
|
+
import type { ColorConfig } from '@suds-cli/statusbar'
|
|
24
24
|
|
|
25
25
|
const sb = StatusbarModel.new(
|
|
26
|
-
{ foreground:
|
|
27
|
-
{ foreground:
|
|
28
|
-
{ foreground:
|
|
29
|
-
{ foreground:
|
|
30
|
-
)
|
|
26
|
+
{ foreground: '#ffffff', background: '#F25D94' }, // Pink - first column
|
|
27
|
+
{ foreground: '#ffffff', background: '#3c3836' }, // Gray - second column
|
|
28
|
+
{ foreground: '#ffffff', background: '#A550DF' }, // Purple - third column
|
|
29
|
+
{ foreground: '#ffffff', background: '#6124DF' }, // Indigo - fourth column
|
|
30
|
+
)
|
|
31
31
|
|
|
32
32
|
// Set size and content
|
|
33
33
|
const updated = sb
|
|
34
34
|
.setSize(80)
|
|
35
|
-
.setContent(
|
|
35
|
+
.setContent('file.txt', '~/.config/nvim', '1/23', 'OK')
|
|
36
36
|
|
|
37
37
|
// Render
|
|
38
|
-
console.log(updated.view())
|
|
38
|
+
console.log(updated.view())
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## Column Layout
|
|
42
42
|
|
|
43
|
-
| Column | Alignment | Width
|
|
44
|
-
|
|
45
|
-
| First | Left | Auto (max 30 chars)
|
|
43
|
+
| Column | Alignment | Width | Truncation |
|
|
44
|
+
| ------ | --------- | ---------------------- | --------------- |
|
|
45
|
+
| First | Left | Auto (max 30 chars) | Yes, with "..." |
|
|
46
46
|
| Second | Left | Flexible (fills space) | Yes, with "..." |
|
|
47
|
-
| Third | Right | Auto
|
|
48
|
-
| Fourth | Left | Auto
|
|
47
|
+
| Third | Right | Auto | No |
|
|
48
|
+
| Fourth | Left | Auto | No |
|
|
49
49
|
|
|
50
50
|
## API
|
|
51
51
|
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chapstick = require('@suds-cli/chapstick');
|
|
4
|
+
var tea = require('@suds-cli/tea');
|
|
5
|
+
|
|
6
|
+
// src/model.ts
|
|
7
|
+
var Height = 1;
|
|
8
|
+
var MAX_FIRST_COLUMN_WIDTH = 30;
|
|
9
|
+
function truncate(text, maxWidth) {
|
|
10
|
+
if (chapstick.width(text) <= maxWidth) {
|
|
11
|
+
return text;
|
|
12
|
+
}
|
|
13
|
+
const ellipsis = "...";
|
|
14
|
+
const availableWidth = maxWidth - chapstick.width(ellipsis);
|
|
15
|
+
if (availableWidth <= 0) {
|
|
16
|
+
return ellipsis.slice(0, maxWidth);
|
|
17
|
+
}
|
|
18
|
+
let result = "";
|
|
19
|
+
for (const char of text) {
|
|
20
|
+
if (chapstick.width(result + char) > availableWidth) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
result += char;
|
|
24
|
+
}
|
|
25
|
+
return result + ellipsis;
|
|
26
|
+
}
|
|
27
|
+
var StatusbarModel = class _StatusbarModel {
|
|
28
|
+
constructor(state) {
|
|
29
|
+
this.state = state;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a new statusbar with column colors.
|
|
33
|
+
* @param first - Color configuration for the first column
|
|
34
|
+
* @param second - Color configuration for the second column
|
|
35
|
+
* @param third - Color configuration for the third column
|
|
36
|
+
* @param fourth - Color configuration for the fourth column
|
|
37
|
+
* @returns A new StatusbarModel instance
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
static new(first, second, third, fourth) {
|
|
41
|
+
return new _StatusbarModel({
|
|
42
|
+
width: 0,
|
|
43
|
+
height: Height,
|
|
44
|
+
firstColumn: "",
|
|
45
|
+
secondColumn: "",
|
|
46
|
+
thirdColumn: "",
|
|
47
|
+
fourthColumn: "",
|
|
48
|
+
firstColumnColors: first,
|
|
49
|
+
secondColumnColors: second,
|
|
50
|
+
thirdColumnColors: third,
|
|
51
|
+
fourthColumnColors: fourth
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Set the total width of the statusbar.
|
|
56
|
+
* @param width - The total width in characters
|
|
57
|
+
* @returns A new StatusbarModel with updated width
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
setSize(width) {
|
|
61
|
+
return new _StatusbarModel({
|
|
62
|
+
...this.state,
|
|
63
|
+
width: Math.max(0, width)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Set text content for all columns.
|
|
68
|
+
* @param first - Text for the first column
|
|
69
|
+
* @param second - Text for the second column
|
|
70
|
+
* @param third - Text for the third column
|
|
71
|
+
* @param fourth - Text for the fourth column
|
|
72
|
+
* @returns A new StatusbarModel with updated content
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
setContent(first, second, third, fourth) {
|
|
76
|
+
return new _StatusbarModel({
|
|
77
|
+
...this.state,
|
|
78
|
+
firstColumn: first,
|
|
79
|
+
secondColumn: second,
|
|
80
|
+
thirdColumn: third,
|
|
81
|
+
fourthColumn: fourth
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Update colors for all columns.
|
|
86
|
+
* @param first - Color configuration for the first column
|
|
87
|
+
* @param second - Color configuration for the second column
|
|
88
|
+
* @param third - Color configuration for the third column
|
|
89
|
+
* @param fourth - Color configuration for the fourth column
|
|
90
|
+
* @returns A new StatusbarModel with updated colors
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
setColors(first, second, third, fourth) {
|
|
94
|
+
return new _StatusbarModel({
|
|
95
|
+
...this.state,
|
|
96
|
+
firstColumnColors: first,
|
|
97
|
+
secondColumnColors: second,
|
|
98
|
+
thirdColumnColors: third,
|
|
99
|
+
fourthColumnColors: fourth
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Handle messages (primarily window resize).
|
|
104
|
+
* @param msg - The message to handle
|
|
105
|
+
* @returns A tuple of the updated model and command
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
update(msg) {
|
|
109
|
+
if (msg instanceof tea.WindowSizeMsg) {
|
|
110
|
+
return [this.setSize(msg.width), null];
|
|
111
|
+
}
|
|
112
|
+
return [this, null];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Render the statusbar as a string.
|
|
116
|
+
* @returns The rendered statusbar
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
view() {
|
|
120
|
+
const { width: totalWidth } = this.state;
|
|
121
|
+
if (totalWidth === 0) {
|
|
122
|
+
return "";
|
|
123
|
+
}
|
|
124
|
+
const firstStyle = new chapstick.Style().foreground(this.state.firstColumnColors.foreground).background(this.state.firstColumnColors.background).padding(0, 1).height(Height);
|
|
125
|
+
const secondStyle = new chapstick.Style().foreground(this.state.secondColumnColors.foreground).background(this.state.secondColumnColors.background).padding(0, 1).height(Height);
|
|
126
|
+
const thirdStyle = new chapstick.Style().foreground(this.state.thirdColumnColors.foreground).background(this.state.thirdColumnColors.background).padding(0, 1).height(Height).alignHorizontal("right");
|
|
127
|
+
const fourthStyle = new chapstick.Style().foreground(this.state.fourthColumnColors.foreground).background(this.state.fourthColumnColors.background).padding(0, 1).height(Height);
|
|
128
|
+
const thirdRendered = thirdStyle.render(this.state.thirdColumn);
|
|
129
|
+
const fourthRendered = fourthStyle.render(this.state.fourthColumn);
|
|
130
|
+
const thirdWidth = chapstick.width(thirdRendered);
|
|
131
|
+
const fourthWidth = chapstick.width(fourthRendered);
|
|
132
|
+
const maxFirstContentWidth = Math.min(
|
|
133
|
+
MAX_FIRST_COLUMN_WIDTH,
|
|
134
|
+
Math.max(0, totalWidth - thirdWidth - fourthWidth - 4)
|
|
135
|
+
// -4 for second column padding
|
|
136
|
+
);
|
|
137
|
+
const firstTruncated = truncate(
|
|
138
|
+
this.state.firstColumn,
|
|
139
|
+
maxFirstContentWidth
|
|
140
|
+
);
|
|
141
|
+
const firstRendered = firstStyle.render(firstTruncated);
|
|
142
|
+
const firstWidth = chapstick.width(firstRendered);
|
|
143
|
+
const secondContentWidth = Math.max(
|
|
144
|
+
0,
|
|
145
|
+
totalWidth - firstWidth - thirdWidth - fourthWidth - 2
|
|
146
|
+
// -2 for padding
|
|
147
|
+
);
|
|
148
|
+
const secondTruncated = truncate(
|
|
149
|
+
this.state.secondColumn,
|
|
150
|
+
secondContentWidth
|
|
151
|
+
);
|
|
152
|
+
const secondRendered = secondStyle.width(secondContentWidth + 2).render(secondTruncated);
|
|
153
|
+
return [firstRendered, secondRendered, thirdRendered, fourthRendered].join(
|
|
154
|
+
""
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
exports.Height = Height;
|
|
160
|
+
exports.StatusbarModel = StatusbarModel;
|
|
161
|
+
//# sourceMappingURL=index.cjs.map
|
|
162
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/model.ts"],"names":["textWidth","WindowSizeMsg","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W,MAAA,CAAO,IAAA,CAAK,MAAM,WAAW,CAAA;AAC9D,IAAA,MAAM,cAAA,GAAiB,WAAA,CAAY,MAAA,CAAO,IAAA,CAAK,MAAM,YAAY,CAAA;AACjE,IAAA,MAAM,UAAA,GAAaF,gBAAU,aAAa,CAAA;AAC1C,IAAA,MAAM,WAAA,GAAcA,gBAAU,cAAc,CAAA;AAG5C,IAAA,MAAM,uBAAuB,IAAA,CAAK,GAAA;AAAA,MAChC,sBAAA;AAAA,MACA,KAAK,GAAA,CAAI,CAAA,EAAG,UAAA,GAAa,UAAA,GAAa,cAAc,CAAC;AAAA;AAAA,KACvD;AACA,IAAA,MAAM,cAAA,GAAiB,QAAA;AAAA,MACrB,KAAK,KAAA,CAAM,WAAA;AAAA,MACX;AAAA,KACF;AACA,IAAA,MAAM,aAAA,GAAgB,UAAA,CAAW,MAAA,CAAO,cAAc,CAAA;AACtD,IAAA,MAAM,UAAA,GAAaA,gBAAU,aAAa,CAAA;AAG1C,IAAA,MAAM,qBAAqB,IAAA,CAAK,GAAA;AAAA,MAC9B,CAAA;AAAA,MACA,UAAA,GAAa,UAAA,GAAa,UAAA,GAAa,WAAA,GAAc;AAAA;AAAA,KACvD;AACA,IAAA,MAAM,eAAA,GAAkB,QAAA;AAAA,MACtB,KAAK,KAAA,CAAM,YAAA;AAAA,MACX;AAAA,KACF;AAGA,IAAA,MAAM,iBAAiB,WAAA,CACpB,KAAA,CAAM,qBAAqB,CAAC,CAAA,CAC5B,OAAO,eAAe,CAAA;AAGzB,IAAA,OAAO,CAAC,aAAA,EAAe,cAAA,EAAgB,aAAA,EAAe,cAAc,CAAA,CAAE,IAAA;AAAA,MACpE;AAAA,KACF;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import { Style, width as textWidth } from '@suds-cli/chapstick'\nimport { WindowSizeMsg, type Cmd, type Msg } from '@suds-cli/tea'\nimport type { ColorConfig, StatusbarState } from './types.js'\n\n/**\n * Height of the status bar (always 1 row).\n * @public\n */\nexport const Height = 1\n\n/**\n * Maximum width for the first column before truncation.\n * @internal\n */\nconst MAX_FIRST_COLUMN_WIDTH = 30\n\n/**\n * Truncate text with ellipsis if it exceeds maxWidth.\n * @internal\n */\nfunction truncate(text: string, maxWidth: number): string {\n if (textWidth(text) <= maxWidth) {\n return text\n }\n\n const ellipsis = '...'\n const availableWidth = maxWidth - textWidth(ellipsis)\n if (availableWidth <= 0) {\n return ellipsis.slice(0, maxWidth)\n }\n\n let result = ''\n for (const char of text) {\n if (textWidth(result + char) > availableWidth) {\n break\n }\n result += char\n }\n\n return result + ellipsis\n}\n\n/**\n * StatusbarModel represents a 4-column status bar component.\n * @public\n */\nexport class StatusbarModel {\n private constructor(private readonly state: StatusbarState) {}\n\n /**\n * Create a new statusbar with column colors.\n * @param first - Color configuration for the first column\n * @param second - Color configuration for the second column\n * @param third - Color configuration for the third column\n * @param fourth - Color configuration for the fourth column\n * @returns A new StatusbarModel instance\n * @public\n */\n static new(\n first: ColorConfig,\n second: ColorConfig,\n third: ColorConfig,\n fourth: ColorConfig,\n ): StatusbarModel {\n return new StatusbarModel({\n width: 0,\n height: Height,\n firstColumn: '',\n secondColumn: '',\n thirdColumn: '',\n fourthColumn: '',\n firstColumnColors: first,\n secondColumnColors: second,\n thirdColumnColors: third,\n fourthColumnColors: fourth,\n })\n }\n\n /**\n * Set the total width of the statusbar.\n * @param width - The total width in characters\n * @returns A new StatusbarModel with updated width\n * @public\n */\n setSize(width: number): StatusbarModel {\n return new StatusbarModel({\n ...this.state,\n width: Math.max(0, width),\n })\n }\n\n /**\n * Set text content for all columns.\n * @param first - Text for the first column\n * @param second - Text for the second column\n * @param third - Text for the third column\n * @param fourth - Text for the fourth column\n * @returns A new StatusbarModel with updated content\n * @public\n */\n setContent(\n first: string,\n second: string,\n third: string,\n fourth: string,\n ): StatusbarModel {\n return new StatusbarModel({\n ...this.state,\n firstColumn: first,\n secondColumn: second,\n thirdColumn: third,\n fourthColumn: fourth,\n })\n }\n\n /**\n * Update colors for all columns.\n * @param first - Color configuration for the first column\n * @param second - Color configuration for the second column\n * @param third - Color configuration for the third column\n * @param fourth - Color configuration for the fourth column\n * @returns A new StatusbarModel with updated colors\n * @public\n */\n setColors(\n first: ColorConfig,\n second: ColorConfig,\n third: ColorConfig,\n fourth: ColorConfig,\n ): StatusbarModel {\n return new StatusbarModel({\n ...this.state,\n firstColumnColors: first,\n secondColumnColors: second,\n thirdColumnColors: third,\n fourthColumnColors: fourth,\n })\n }\n\n /**\n * Handle messages (primarily window resize).\n * @param msg - The message to handle\n * @returns A tuple of the updated model and command\n * @public\n */\n update(msg: Msg): [StatusbarModel, Cmd<Msg>] {\n if (msg instanceof WindowSizeMsg) {\n return [this.setSize(msg.width), null]\n }\n return [this, null]\n }\n\n /**\n * Render the statusbar as a string.\n * @returns The rendered statusbar\n * @public\n */\n view(): string {\n const { width: totalWidth } = this.state\n\n if (totalWidth === 0) {\n return ''\n }\n\n // Build styled columns\n const firstStyle = new Style()\n .foreground(this.state.firstColumnColors.foreground)\n .background(this.state.firstColumnColors.background)\n .padding(0, 1)\n .height(Height)\n\n const secondStyle = new Style()\n .foreground(this.state.secondColumnColors.foreground)\n .background(this.state.secondColumnColors.background)\n .padding(0, 1)\n .height(Height)\n\n const thirdStyle = new Style()\n .foreground(this.state.thirdColumnColors.foreground)\n .background(this.state.thirdColumnColors.background)\n .padding(0, 1)\n .height(Height)\n .alignHorizontal('right')\n\n const fourthStyle = new Style()\n .foreground(this.state.fourthColumnColors.foreground)\n .background(this.state.fourthColumnColors.background)\n .padding(0, 1)\n .height(Height)\n\n // Render third and fourth columns (they don't truncate)\n const thirdRendered = thirdStyle.render(this.state.thirdColumn)\n const fourthRendered = fourthStyle.render(this.state.fourthColumn)\n const thirdWidth = textWidth(thirdRendered)\n const fourthWidth = textWidth(fourthRendered)\n\n // Calculate max width for first column (limited to 30 chars of content + padding)\n const maxFirstContentWidth = Math.min(\n MAX_FIRST_COLUMN_WIDTH,\n Math.max(0, totalWidth - thirdWidth - fourthWidth - 4), // -4 for second column padding\n )\n const firstTruncated = truncate(\n this.state.firstColumn,\n maxFirstContentWidth,\n )\n const firstRendered = firstStyle.render(firstTruncated)\n const firstWidth = textWidth(firstRendered)\n\n // Calculate remaining width for second column\n const secondContentWidth = Math.max(\n 0,\n totalWidth - firstWidth - thirdWidth - fourthWidth - 2, // -2 for padding\n )\n const secondTruncated = truncate(\n this.state.secondColumn,\n secondContentWidth,\n )\n\n // Set width for second column to fill remaining space\n const secondRendered = secondStyle\n .width(secondContentWidth + 2)\n .render(secondTruncated)\n\n // Join columns horizontally\n return [firstRendered, secondRendered, thirdRendered, fourthRendered].join(\n '',\n )\n }\n}\n"]}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Msg, Cmd } from '@suds-cli/tea';
|
|
2
|
+
import { ColorInput } from '@suds-cli/chapstick';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Color configuration for a statusbar column.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
interface ColorConfig {
|
|
9
|
+
foreground: ColorInput;
|
|
10
|
+
background: ColorInput;
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
/**
|
|
4
14
|
* Height of the status bar (always 1 row).
|
|
5
15
|
* @public
|
|
6
16
|
*/
|
|
7
|
-
|
|
17
|
+
declare const Height = 1;
|
|
8
18
|
/**
|
|
9
19
|
* StatusbarModel represents a 4-column status bar component.
|
|
10
20
|
* @public
|
|
11
21
|
*/
|
|
12
|
-
|
|
22
|
+
declare class StatusbarModel {
|
|
13
23
|
private readonly state;
|
|
14
24
|
private constructor();
|
|
15
25
|
/**
|
|
@@ -63,4 +73,5 @@ export declare class StatusbarModel {
|
|
|
63
73
|
*/
|
|
64
74
|
view(): string;
|
|
65
75
|
}
|
|
66
|
-
|
|
76
|
+
|
|
77
|
+
export { type ColorConfig, Height, StatusbarModel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Msg, Cmd } from '@suds-cli/tea';
|
|
2
|
+
import { ColorInput } from '@suds-cli/chapstick';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Color configuration for a statusbar column.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
interface ColorConfig {
|
|
9
|
+
foreground: ColorInput;
|
|
10
|
+
background: ColorInput;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Height of the status bar (always 1 row).
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
declare const Height = 1;
|
|
18
|
+
/**
|
|
19
|
+
* StatusbarModel represents a 4-column status bar component.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
declare class StatusbarModel {
|
|
23
|
+
private readonly state;
|
|
24
|
+
private constructor();
|
|
25
|
+
/**
|
|
26
|
+
* Create a new statusbar with column colors.
|
|
27
|
+
* @param first - Color configuration for the first column
|
|
28
|
+
* @param second - Color configuration for the second column
|
|
29
|
+
* @param third - Color configuration for the third column
|
|
30
|
+
* @param fourth - Color configuration for the fourth column
|
|
31
|
+
* @returns A new StatusbarModel instance
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
static new(first: ColorConfig, second: ColorConfig, third: ColorConfig, fourth: ColorConfig): StatusbarModel;
|
|
35
|
+
/**
|
|
36
|
+
* Set the total width of the statusbar.
|
|
37
|
+
* @param width - The total width in characters
|
|
38
|
+
* @returns A new StatusbarModel with updated width
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
setSize(width: number): StatusbarModel;
|
|
42
|
+
/**
|
|
43
|
+
* Set text content for all columns.
|
|
44
|
+
* @param first - Text for the first column
|
|
45
|
+
* @param second - Text for the second column
|
|
46
|
+
* @param third - Text for the third column
|
|
47
|
+
* @param fourth - Text for the fourth column
|
|
48
|
+
* @returns A new StatusbarModel with updated content
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
setContent(first: string, second: string, third: string, fourth: string): StatusbarModel;
|
|
52
|
+
/**
|
|
53
|
+
* Update colors for all columns.
|
|
54
|
+
* @param first - Color configuration for the first column
|
|
55
|
+
* @param second - Color configuration for the second column
|
|
56
|
+
* @param third - Color configuration for the third column
|
|
57
|
+
* @param fourth - Color configuration for the fourth column
|
|
58
|
+
* @returns A new StatusbarModel with updated colors
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
setColors(first: ColorConfig, second: ColorConfig, third: ColorConfig, fourth: ColorConfig): StatusbarModel;
|
|
62
|
+
/**
|
|
63
|
+
* Handle messages (primarily window resize).
|
|
64
|
+
* @param msg - The message to handle
|
|
65
|
+
* @returns A tuple of the updated model and command
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
update(msg: Msg): [StatusbarModel, Cmd<Msg>];
|
|
69
|
+
/**
|
|
70
|
+
* Render the statusbar as a string.
|
|
71
|
+
* @returns The rendered statusbar
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
view(): string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { type ColorConfig, Height, StatusbarModel };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,159 @@
|
|
|
1
|
-
|
|
1
|
+
import { Style, width } from '@suds-cli/chapstick';
|
|
2
|
+
import { WindowSizeMsg } from '@suds-cli/tea';
|
|
3
|
+
|
|
4
|
+
// src/model.ts
|
|
5
|
+
var Height = 1;
|
|
6
|
+
var MAX_FIRST_COLUMN_WIDTH = 30;
|
|
7
|
+
function truncate(text, maxWidth) {
|
|
8
|
+
if (width(text) <= maxWidth) {
|
|
9
|
+
return text;
|
|
10
|
+
}
|
|
11
|
+
const ellipsis = "...";
|
|
12
|
+
const availableWidth = maxWidth - width(ellipsis);
|
|
13
|
+
if (availableWidth <= 0) {
|
|
14
|
+
return ellipsis.slice(0, maxWidth);
|
|
15
|
+
}
|
|
16
|
+
let result = "";
|
|
17
|
+
for (const char of text) {
|
|
18
|
+
if (width(result + char) > availableWidth) {
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
result += char;
|
|
22
|
+
}
|
|
23
|
+
return result + ellipsis;
|
|
24
|
+
}
|
|
25
|
+
var StatusbarModel = class _StatusbarModel {
|
|
26
|
+
constructor(state) {
|
|
27
|
+
this.state = state;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a new statusbar with column colors.
|
|
31
|
+
* @param first - Color configuration for the first column
|
|
32
|
+
* @param second - Color configuration for the second column
|
|
33
|
+
* @param third - Color configuration for the third column
|
|
34
|
+
* @param fourth - Color configuration for the fourth column
|
|
35
|
+
* @returns A new StatusbarModel instance
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
static new(first, second, third, fourth) {
|
|
39
|
+
return new _StatusbarModel({
|
|
40
|
+
width: 0,
|
|
41
|
+
height: Height,
|
|
42
|
+
firstColumn: "",
|
|
43
|
+
secondColumn: "",
|
|
44
|
+
thirdColumn: "",
|
|
45
|
+
fourthColumn: "",
|
|
46
|
+
firstColumnColors: first,
|
|
47
|
+
secondColumnColors: second,
|
|
48
|
+
thirdColumnColors: third,
|
|
49
|
+
fourthColumnColors: fourth
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Set the total width of the statusbar.
|
|
54
|
+
* @param width - The total width in characters
|
|
55
|
+
* @returns A new StatusbarModel with updated width
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
setSize(width) {
|
|
59
|
+
return new _StatusbarModel({
|
|
60
|
+
...this.state,
|
|
61
|
+
width: Math.max(0, width)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Set text content for all columns.
|
|
66
|
+
* @param first - Text for the first column
|
|
67
|
+
* @param second - Text for the second column
|
|
68
|
+
* @param third - Text for the third column
|
|
69
|
+
* @param fourth - Text for the fourth column
|
|
70
|
+
* @returns A new StatusbarModel with updated content
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
setContent(first, second, third, fourth) {
|
|
74
|
+
return new _StatusbarModel({
|
|
75
|
+
...this.state,
|
|
76
|
+
firstColumn: first,
|
|
77
|
+
secondColumn: second,
|
|
78
|
+
thirdColumn: third,
|
|
79
|
+
fourthColumn: fourth
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Update colors for all columns.
|
|
84
|
+
* @param first - Color configuration for the first column
|
|
85
|
+
* @param second - Color configuration for the second column
|
|
86
|
+
* @param third - Color configuration for the third column
|
|
87
|
+
* @param fourth - Color configuration for the fourth column
|
|
88
|
+
* @returns A new StatusbarModel with updated colors
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
setColors(first, second, third, fourth) {
|
|
92
|
+
return new _StatusbarModel({
|
|
93
|
+
...this.state,
|
|
94
|
+
firstColumnColors: first,
|
|
95
|
+
secondColumnColors: second,
|
|
96
|
+
thirdColumnColors: third,
|
|
97
|
+
fourthColumnColors: fourth
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Handle messages (primarily window resize).
|
|
102
|
+
* @param msg - The message to handle
|
|
103
|
+
* @returns A tuple of the updated model and command
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
update(msg) {
|
|
107
|
+
if (msg instanceof WindowSizeMsg) {
|
|
108
|
+
return [this.setSize(msg.width), null];
|
|
109
|
+
}
|
|
110
|
+
return [this, null];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Render the statusbar as a string.
|
|
114
|
+
* @returns The rendered statusbar
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
view() {
|
|
118
|
+
const { width: totalWidth } = this.state;
|
|
119
|
+
if (totalWidth === 0) {
|
|
120
|
+
return "";
|
|
121
|
+
}
|
|
122
|
+
const firstStyle = new Style().foreground(this.state.firstColumnColors.foreground).background(this.state.firstColumnColors.background).padding(0, 1).height(Height);
|
|
123
|
+
const secondStyle = new Style().foreground(this.state.secondColumnColors.foreground).background(this.state.secondColumnColors.background).padding(0, 1).height(Height);
|
|
124
|
+
const thirdStyle = new Style().foreground(this.state.thirdColumnColors.foreground).background(this.state.thirdColumnColors.background).padding(0, 1).height(Height).alignHorizontal("right");
|
|
125
|
+
const fourthStyle = new Style().foreground(this.state.fourthColumnColors.foreground).background(this.state.fourthColumnColors.background).padding(0, 1).height(Height);
|
|
126
|
+
const thirdRendered = thirdStyle.render(this.state.thirdColumn);
|
|
127
|
+
const fourthRendered = fourthStyle.render(this.state.fourthColumn);
|
|
128
|
+
const thirdWidth = width(thirdRendered);
|
|
129
|
+
const fourthWidth = width(fourthRendered);
|
|
130
|
+
const maxFirstContentWidth = Math.min(
|
|
131
|
+
MAX_FIRST_COLUMN_WIDTH,
|
|
132
|
+
Math.max(0, totalWidth - thirdWidth - fourthWidth - 4)
|
|
133
|
+
// -4 for second column padding
|
|
134
|
+
);
|
|
135
|
+
const firstTruncated = truncate(
|
|
136
|
+
this.state.firstColumn,
|
|
137
|
+
maxFirstContentWidth
|
|
138
|
+
);
|
|
139
|
+
const firstRendered = firstStyle.render(firstTruncated);
|
|
140
|
+
const firstWidth = width(firstRendered);
|
|
141
|
+
const secondContentWidth = Math.max(
|
|
142
|
+
0,
|
|
143
|
+
totalWidth - firstWidth - thirdWidth - fourthWidth - 2
|
|
144
|
+
// -2 for padding
|
|
145
|
+
);
|
|
146
|
+
const secondTruncated = truncate(
|
|
147
|
+
this.state.secondColumn,
|
|
148
|
+
secondContentWidth
|
|
149
|
+
);
|
|
150
|
+
const secondRendered = secondStyle.width(secondContentWidth + 2).render(secondTruncated);
|
|
151
|
+
return [firstRendered, secondRendered, thirdRendered, fourthRendered].join(
|
|
152
|
+
""
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export { Height, StatusbarModel };
|
|
158
|
+
//# sourceMappingURL=index.js.map
|
|
2
159
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../src/model.ts"],"names":["textWidth"],"mappings":";;;;AAQO,IAAM,MAAA,GAAS;AAMtB,IAAM,sBAAA,GAAyB,EAAA;AAM/B,SAAS,QAAA,CAAS,MAAc,QAAA,EAA0B;AACxD,EAAA,IAAIA,KAAA,CAAU,IAAI,CAAA,IAAK,QAAA,EAAU;AAC/B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,QAAA,GAAW,KAAA;AACjB,EAAA,MAAM,cAAA,GAAiB,QAAA,GAAWA,KAAA,CAAU,QAAQ,CAAA;AACpD,EAAA,IAAI,kBAAkB,CAAA,EAAG;AACvB,IAAA,OAAO,QAAA,CAAS,KAAA,CAAM,CAAA,EAAG,QAAQ,CAAA;AAAA,EACnC;AAEA,EAAA,IAAI,MAAA,GAAS,EAAA;AACb,EAAA,KAAA,MAAW,QAAQ,IAAA,EAAM;AACvB,IAAA,IAAIA,KAAA,CAAU,MAAA,GAAS,IAAI,CAAA,GAAI,cAAA,EAAgB;AAC7C,MAAA;AAAA,IACF;AACA,IAAA,MAAA,IAAU,IAAA;AAAA,EACZ;AAEA,EAAA,OAAO,MAAA,GAAS,QAAA;AAClB;AAMO,IAAM,cAAA,GAAN,MAAM,eAAA,CAAe;AAAA,EAClB,YAA6B,KAAA,EAAuB;AAAvB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAAA,EAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW7D,OAAO,GAAA,CACL,KAAA,EACA,MAAA,EACA,OACA,MAAA,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,aAAA,EAAe,cAAA,EAAgB,aAAA,EAAe,cAAc,CAAA,CAAE,IAAA;AAAA,MACpE;AAAA,KACF;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import { Style, width as textWidth } from '@suds-cli/chapstick'\nimport { WindowSizeMsg, type Cmd, type Msg } from '@suds-cli/tea'\nimport type { ColorConfig, StatusbarState } from './types.js'\n\n/**\n * Height of the status bar (always 1 row).\n * @public\n */\nexport const Height = 1\n\n/**\n * Maximum width for the first column before truncation.\n * @internal\n */\nconst MAX_FIRST_COLUMN_WIDTH = 30\n\n/**\n * Truncate text with ellipsis if it exceeds maxWidth.\n * @internal\n */\nfunction truncate(text: string, maxWidth: number): string {\n if (textWidth(text) <= maxWidth) {\n return text\n }\n\n const ellipsis = '...'\n const availableWidth = maxWidth - textWidth(ellipsis)\n if (availableWidth <= 0) {\n return ellipsis.slice(0, maxWidth)\n }\n\n let result = ''\n for (const char of text) {\n if (textWidth(result + char) > availableWidth) {\n break\n }\n result += char\n }\n\n return result + ellipsis\n}\n\n/**\n * StatusbarModel represents a 4-column status bar component.\n * @public\n */\nexport class StatusbarModel {\n private constructor(private readonly state: StatusbarState) {}\n\n /**\n * Create a new statusbar with column colors.\n * @param first - Color configuration for the first column\n * @param second - Color configuration for the second column\n * @param third - Color configuration for the third column\n * @param fourth - Color configuration for the fourth column\n * @returns A new StatusbarModel instance\n * @public\n */\n static new(\n first: ColorConfig,\n second: ColorConfig,\n third: ColorConfig,\n fourth: ColorConfig,\n ): StatusbarModel {\n return new StatusbarModel({\n width: 0,\n height: Height,\n firstColumn: '',\n secondColumn: '',\n thirdColumn: '',\n fourthColumn: '',\n firstColumnColors: first,\n secondColumnColors: second,\n thirdColumnColors: third,\n fourthColumnColors: fourth,\n })\n }\n\n /**\n * Set the total width of the statusbar.\n * @param width - The total width in characters\n * @returns A new StatusbarModel with updated width\n * @public\n */\n setSize(width: number): StatusbarModel {\n return new StatusbarModel({\n ...this.state,\n width: Math.max(0, width),\n })\n }\n\n /**\n * Set text content for all columns.\n * @param first - Text for the first column\n * @param second - Text for the second column\n * @param third - Text for the third column\n * @param fourth - Text for the fourth column\n * @returns A new StatusbarModel with updated content\n * @public\n */\n setContent(\n first: string,\n second: string,\n third: string,\n fourth: string,\n ): StatusbarModel {\n return new StatusbarModel({\n ...this.state,\n firstColumn: first,\n secondColumn: second,\n thirdColumn: third,\n fourthColumn: fourth,\n })\n }\n\n /**\n * Update colors for all columns.\n * @param first - Color configuration for the first column\n * @param second - Color configuration for the second column\n * @param third - Color configuration for the third column\n * @param fourth - Color configuration for the fourth column\n * @returns A new StatusbarModel with updated colors\n * @public\n */\n setColors(\n first: ColorConfig,\n second: ColorConfig,\n third: ColorConfig,\n fourth: ColorConfig,\n ): StatusbarModel {\n return new StatusbarModel({\n ...this.state,\n firstColumnColors: first,\n secondColumnColors: second,\n thirdColumnColors: third,\n fourthColumnColors: fourth,\n })\n }\n\n /**\n * Handle messages (primarily window resize).\n * @param msg - The message to handle\n * @returns A tuple of the updated model and command\n * @public\n */\n update(msg: Msg): [StatusbarModel, Cmd<Msg>] {\n if (msg instanceof WindowSizeMsg) {\n return [this.setSize(msg.width), null]\n }\n return [this, null]\n }\n\n /**\n * Render the statusbar as a string.\n * @returns The rendered statusbar\n * @public\n */\n view(): string {\n const { width: totalWidth } = this.state\n\n if (totalWidth === 0) {\n return ''\n }\n\n // Build styled columns\n const firstStyle = new Style()\n .foreground(this.state.firstColumnColors.foreground)\n .background(this.state.firstColumnColors.background)\n .padding(0, 1)\n .height(Height)\n\n const secondStyle = new Style()\n .foreground(this.state.secondColumnColors.foreground)\n .background(this.state.secondColumnColors.background)\n .padding(0, 1)\n .height(Height)\n\n const thirdStyle = new Style()\n .foreground(this.state.thirdColumnColors.foreground)\n .background(this.state.thirdColumnColors.background)\n .padding(0, 1)\n .height(Height)\n .alignHorizontal('right')\n\n const fourthStyle = new Style()\n .foreground(this.state.fourthColumnColors.foreground)\n .background(this.state.fourthColumnColors.background)\n .padding(0, 1)\n .height(Height)\n\n // Render third and fourth columns (they don't truncate)\n const thirdRendered = thirdStyle.render(this.state.thirdColumn)\n const fourthRendered = fourthStyle.render(this.state.fourthColumn)\n const thirdWidth = textWidth(thirdRendered)\n const fourthWidth = textWidth(fourthRendered)\n\n // Calculate max width for first column (limited to 30 chars of content + padding)\n const maxFirstContentWidth = Math.min(\n MAX_FIRST_COLUMN_WIDTH,\n Math.max(0, totalWidth - thirdWidth - fourthWidth - 4), // -4 for second column padding\n )\n const firstTruncated = truncate(\n this.state.firstColumn,\n maxFirstContentWidth,\n )\n const firstRendered = firstStyle.render(firstTruncated)\n const firstWidth = textWidth(firstRendered)\n\n // Calculate remaining width for second column\n const secondContentWidth = Math.max(\n 0,\n totalWidth - firstWidth - thirdWidth - fourthWidth - 2, // -2 for padding\n )\n const secondTruncated = truncate(\n this.state.secondColumn,\n secondContentWidth,\n )\n\n // Set width for second column to fill remaining space\n const secondRendered = secondStyle\n .width(secondContentWidth + 2)\n .render(secondTruncated)\n\n // Join columns horizontally\n return [firstRendered, secondRendered, thirdRendered, fourthRendered].join(\n '',\n )\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,31 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suds-cli/statusbar",
|
|
3
|
-
"version": "0.1.0-alpha.0",
|
|
4
3
|
"description": "Status bar component for Suds terminal UIs",
|
|
5
|
-
"
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
4
|
+
"version": "0.1.0-alpha.1",
|
|
11
5
|
"dependencies": {
|
|
12
|
-
"@suds-cli/chapstick": "0.1.0-alpha.
|
|
13
|
-
"@suds-cli/tea": "0.0.0"
|
|
6
|
+
"@suds-cli/chapstick": "0.1.0-alpha.1",
|
|
7
|
+
"@suds-cli/tea": "0.1.0-alpha.0"
|
|
14
8
|
},
|
|
15
9
|
"devDependencies": {
|
|
16
10
|
"typescript": "5.8.2",
|
|
17
|
-
"vitest": "^4.0.
|
|
11
|
+
"vitest": "^4.0.16"
|
|
18
12
|
},
|
|
19
13
|
"engines": {
|
|
20
14
|
"node": ">=20.0.0"
|
|
21
15
|
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"require": {
|
|
23
|
+
"types": "./dist/index.d.cts",
|
|
24
|
+
"default": "./dist/index.cjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"main": "./dist/index.cjs",
|
|
33
|
+
"module": "./dist/index.js",
|
|
34
|
+
"type": "module",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
22
36
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"build": "pnpm run clean && tsc -p ./tsconfig.json",
|
|
25
|
-
"test": "vitest run",
|
|
26
|
-
"generate:api-report": "api-extractor run --local",
|
|
37
|
+
"build": "tsup",
|
|
27
38
|
"check:api-report": "pnpm run generate:api-report",
|
|
28
39
|
"check:eslint": "pnpm run lint",
|
|
29
|
-
"
|
|
40
|
+
"generate:api-report": "api-extractor run --local",
|
|
41
|
+
"lint": "eslint \"{src,test}/**/*.{ts,tsx}\"",
|
|
42
|
+
"test": "vitest run"
|
|
30
43
|
}
|
|
31
44
|
}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/model.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,YAAY,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,MAAM,IAAI,CAAC;AAkCxB;;;GAGG;AACH,qBAAa,cAAc;IACL,OAAO,CAAC,QAAQ,CAAC,KAAK;IAA1C,OAAO;IAEP;;;;;;;;OAQG;IACH,MAAM,CAAC,GAAG,CACR,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,GAClB,cAAc;IAejB;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc;IAOtC;;;;;;;;OAQG;IACH,UAAU,CACR,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,cAAc;IAUjB;;;;;;;;OAQG;IACH,SAAS,CACP,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,GAClB,cAAc;IAUjB;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAO5C;;;;OAIG;IACH,IAAI,IAAI,MAAM;CA8Df"}
|
package/dist/model.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { Style, width as textWidth } from "@suds-cli/chapstick";
|
|
2
|
-
import { WindowSizeMsg } from "@suds-cli/tea";
|
|
3
|
-
/**
|
|
4
|
-
* Height of the status bar (always 1 row).
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export const Height = 1;
|
|
8
|
-
/**
|
|
9
|
-
* Maximum width for the first column before truncation.
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
const MAX_FIRST_COLUMN_WIDTH = 30;
|
|
13
|
-
/**
|
|
14
|
-
* Truncate text with ellipsis if it exceeds maxWidth.
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
function truncate(text, maxWidth) {
|
|
18
|
-
if (textWidth(text) <= maxWidth) {
|
|
19
|
-
return text;
|
|
20
|
-
}
|
|
21
|
-
const ellipsis = "...";
|
|
22
|
-
const availableWidth = maxWidth - textWidth(ellipsis);
|
|
23
|
-
if (availableWidth <= 0) {
|
|
24
|
-
return ellipsis.slice(0, maxWidth);
|
|
25
|
-
}
|
|
26
|
-
let result = "";
|
|
27
|
-
for (const char of text) {
|
|
28
|
-
if (textWidth(result + char) > availableWidth) {
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
result += char;
|
|
32
|
-
}
|
|
33
|
-
return result + ellipsis;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* StatusbarModel represents a 4-column status bar component.
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
export class StatusbarModel {
|
|
40
|
-
state;
|
|
41
|
-
constructor(state) {
|
|
42
|
-
this.state = state;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Create a new statusbar with column colors.
|
|
46
|
-
* @param first - Color configuration for the first column
|
|
47
|
-
* @param second - Color configuration for the second column
|
|
48
|
-
* @param third - Color configuration for the third column
|
|
49
|
-
* @param fourth - Color configuration for the fourth column
|
|
50
|
-
* @returns A new StatusbarModel instance
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
static new(first, second, third, fourth) {
|
|
54
|
-
return new StatusbarModel({
|
|
55
|
-
width: 0,
|
|
56
|
-
height: Height,
|
|
57
|
-
firstColumn: "",
|
|
58
|
-
secondColumn: "",
|
|
59
|
-
thirdColumn: "",
|
|
60
|
-
fourthColumn: "",
|
|
61
|
-
firstColumnColors: first,
|
|
62
|
-
secondColumnColors: second,
|
|
63
|
-
thirdColumnColors: third,
|
|
64
|
-
fourthColumnColors: fourth,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Set the total width of the statusbar.
|
|
69
|
-
* @param width - The total width in characters
|
|
70
|
-
* @returns A new StatusbarModel with updated width
|
|
71
|
-
* @public
|
|
72
|
-
*/
|
|
73
|
-
setSize(width) {
|
|
74
|
-
return new StatusbarModel({
|
|
75
|
-
...this.state,
|
|
76
|
-
width: Math.max(0, width),
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Set text content for all columns.
|
|
81
|
-
* @param first - Text for the first column
|
|
82
|
-
* @param second - Text for the second column
|
|
83
|
-
* @param third - Text for the third column
|
|
84
|
-
* @param fourth - Text for the fourth column
|
|
85
|
-
* @returns A new StatusbarModel with updated content
|
|
86
|
-
* @public
|
|
87
|
-
*/
|
|
88
|
-
setContent(first, second, third, fourth) {
|
|
89
|
-
return new StatusbarModel({
|
|
90
|
-
...this.state,
|
|
91
|
-
firstColumn: first,
|
|
92
|
-
secondColumn: second,
|
|
93
|
-
thirdColumn: third,
|
|
94
|
-
fourthColumn: fourth,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Update colors for all columns.
|
|
99
|
-
* @param first - Color configuration for the first column
|
|
100
|
-
* @param second - Color configuration for the second column
|
|
101
|
-
* @param third - Color configuration for the third column
|
|
102
|
-
* @param fourth - Color configuration for the fourth column
|
|
103
|
-
* @returns A new StatusbarModel with updated colors
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
|
-
setColors(first, second, third, fourth) {
|
|
107
|
-
return new StatusbarModel({
|
|
108
|
-
...this.state,
|
|
109
|
-
firstColumnColors: first,
|
|
110
|
-
secondColumnColors: second,
|
|
111
|
-
thirdColumnColors: third,
|
|
112
|
-
fourthColumnColors: fourth,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Handle messages (primarily window resize).
|
|
117
|
-
* @param msg - The message to handle
|
|
118
|
-
* @returns A tuple of the updated model and command
|
|
119
|
-
* @public
|
|
120
|
-
*/
|
|
121
|
-
update(msg) {
|
|
122
|
-
if (msg instanceof WindowSizeMsg) {
|
|
123
|
-
return [this.setSize(msg.width), null];
|
|
124
|
-
}
|
|
125
|
-
return [this, null];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Render the statusbar as a string.
|
|
129
|
-
* @returns The rendered statusbar
|
|
130
|
-
* @public
|
|
131
|
-
*/
|
|
132
|
-
view() {
|
|
133
|
-
const { width: totalWidth } = this.state;
|
|
134
|
-
if (totalWidth === 0) {
|
|
135
|
-
return "";
|
|
136
|
-
}
|
|
137
|
-
// Build styled columns
|
|
138
|
-
const firstStyle = new Style()
|
|
139
|
-
.foreground(this.state.firstColumnColors.foreground)
|
|
140
|
-
.background(this.state.firstColumnColors.background)
|
|
141
|
-
.padding(0, 1)
|
|
142
|
-
.height(Height);
|
|
143
|
-
const secondStyle = new Style()
|
|
144
|
-
.foreground(this.state.secondColumnColors.foreground)
|
|
145
|
-
.background(this.state.secondColumnColors.background)
|
|
146
|
-
.padding(0, 1)
|
|
147
|
-
.height(Height);
|
|
148
|
-
const thirdStyle = new Style()
|
|
149
|
-
.foreground(this.state.thirdColumnColors.foreground)
|
|
150
|
-
.background(this.state.thirdColumnColors.background)
|
|
151
|
-
.padding(0, 1)
|
|
152
|
-
.height(Height)
|
|
153
|
-
.alignHorizontal("right");
|
|
154
|
-
const fourthStyle = new Style()
|
|
155
|
-
.foreground(this.state.fourthColumnColors.foreground)
|
|
156
|
-
.background(this.state.fourthColumnColors.background)
|
|
157
|
-
.padding(0, 1)
|
|
158
|
-
.height(Height);
|
|
159
|
-
// Render third and fourth columns (they don't truncate)
|
|
160
|
-
const thirdRendered = thirdStyle.render(this.state.thirdColumn);
|
|
161
|
-
const fourthRendered = fourthStyle.render(this.state.fourthColumn);
|
|
162
|
-
const thirdWidth = textWidth(thirdRendered);
|
|
163
|
-
const fourthWidth = textWidth(fourthRendered);
|
|
164
|
-
// Calculate max width for first column (limited to 30 chars of content + padding)
|
|
165
|
-
const maxFirstContentWidth = Math.min(MAX_FIRST_COLUMN_WIDTH, Math.max(0, totalWidth - thirdWidth - fourthWidth - 4));
|
|
166
|
-
const firstTruncated = truncate(this.state.firstColumn, maxFirstContentWidth);
|
|
167
|
-
const firstRendered = firstStyle.render(firstTruncated);
|
|
168
|
-
const firstWidth = textWidth(firstRendered);
|
|
169
|
-
// Calculate remaining width for second column
|
|
170
|
-
const secondContentWidth = Math.max(0, totalWidth - firstWidth - thirdWidth - fourthWidth - 2);
|
|
171
|
-
const secondTruncated = truncate(this.state.secondColumn, secondContentWidth);
|
|
172
|
-
// Set width for second column to fill remaining space
|
|
173
|
-
const secondRendered = secondStyle.width(secondContentWidth + 2).render(secondTruncated);
|
|
174
|
-
// Join columns horizontally
|
|
175
|
-
return [firstRendered, secondRendered, thirdRendered, fourthRendered]
|
|
176
|
-
.join("");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
//# sourceMappingURL=model.js.map
|
package/dist/model.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAsB,MAAM,eAAe,CAAC;AAGlE;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AAExB;;;GAGG;AACH,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC;;;GAGG;AACH,SAAS,QAAQ,CAAC,IAAY,EAAE,QAAgB;IAC9C,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,QAAQ,EAAE,CA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G,UAAU,GAAG,WAAW,GAAG,CAAC,CAAC,CACvD,CAAC;QACF,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;QAC9E,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACxD,MAAM,UAAU,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;QAE5C,8CAA8C;QAC9C,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CACjC,CAAC,EACD,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,CAAC,CACvD,CAAC;QACF,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;QAE9E,sDAAsD;QACtD,MAAM,cAAc,GAAG,WAAW,CAAC,KAAK,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAEzF,4BAA4B;QAC5B,OAAO,CAAC,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,CAAC;aAClE,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;CACF"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ColorInput } from "@suds-cli/chapstick";
|
|
2
|
-
/**
|
|
3
|
-
* Color configuration for a statusbar column.
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface ColorConfig {
|
|
7
|
-
foreground: ColorInput;
|
|
8
|
-
background: ColorInput;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Internal state for the statusbar model.
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export interface StatusbarState {
|
|
15
|
-
width: number;
|
|
16
|
-
height: number;
|
|
17
|
-
firstColumn: string;
|
|
18
|
-
secondColumn: string;
|
|
19
|
-
thirdColumn: string;
|
|
20
|
-
fourthColumn: string;
|
|
21
|
-
firstColumnColors: ColorConfig;
|
|
22
|
-
secondColumnColors: ColorConfig;
|
|
23
|
-
thirdColumnColors: ColorConfig;
|
|
24
|
-
fourthColumnColors: ColorConfig;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,WAAW,CAAC;IAC/B,kBAAkB,EAAE,WAAW,CAAC;IAChC,iBAAiB,EAAE,WAAW,CAAC;IAC/B,kBAAkB,EAAE,WAAW,CAAC;CACjC"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|