@suds-cli/statusbar 0.1.0-alpha.0
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 +78 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/model.d.ts +66 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +179 -0
- package/dist/model.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# @suds-cli/statusbar
|
|
2
|
+
|
|
3
|
+
A 4-column status bar component for terminal UIs, ported from [teacup](https://github.com/mistakenelf/teacup).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Fixed 1-row height status bar
|
|
8
|
+
- 4 configurable columns with individual colors
|
|
9
|
+
- Automatic text truncation with ellipsis
|
|
10
|
+
- Responsive width handling
|
|
11
|
+
- Adaptive colors (light/dark mode support)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @suds-cli/statusbar
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { StatusbarModel } from "@suds-cli/statusbar";
|
|
23
|
+
import type { ColorConfig } from "@suds-cli/statusbar";
|
|
24
|
+
|
|
25
|
+
const sb = StatusbarModel.new(
|
|
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
|
+
|
|
32
|
+
// Set size and content
|
|
33
|
+
const updated = sb
|
|
34
|
+
.setSize(80)
|
|
35
|
+
.setContent("file.txt", "~/.config/nvim", "1/23", "OK");
|
|
36
|
+
|
|
37
|
+
// Render
|
|
38
|
+
console.log(updated.view());
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Column Layout
|
|
42
|
+
|
|
43
|
+
| Column | Alignment | Width | Truncation |
|
|
44
|
+
|--------|-----------|-------|------------|
|
|
45
|
+
| First | Left | Auto (max 30 chars) | Yes, with "..." |
|
|
46
|
+
| Second | Left | Flexible (fills space) | Yes, with "..." |
|
|
47
|
+
| Third | Right | Auto | No |
|
|
48
|
+
| Fourth | Left | Auto | No |
|
|
49
|
+
|
|
50
|
+
## API
|
|
51
|
+
|
|
52
|
+
### `StatusbarModel.new(first, second, third, fourth)`
|
|
53
|
+
|
|
54
|
+
Create a new statusbar with color configuration for each column.
|
|
55
|
+
|
|
56
|
+
### `setSize(width: number)`
|
|
57
|
+
|
|
58
|
+
Set the total width of the statusbar.
|
|
59
|
+
|
|
60
|
+
### `setContent(first, second, third, fourth)`
|
|
61
|
+
|
|
62
|
+
Update the text content for all columns.
|
|
63
|
+
|
|
64
|
+
### `setColors(first, second, third, fourth)`
|
|
65
|
+
|
|
66
|
+
Update the color configuration for all columns.
|
|
67
|
+
|
|
68
|
+
### `update(msg: Msg)`
|
|
69
|
+
|
|
70
|
+
Handle messages (primarily `WindowSizeMsg` for window resizing).
|
|
71
|
+
|
|
72
|
+
### `view()`
|
|
73
|
+
|
|
74
|
+
Render the statusbar to a string.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
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/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type Cmd, type Msg } from "@suds-cli/tea";
|
|
2
|
+
import type { ColorConfig } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Height of the status bar (always 1 row).
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const Height = 1;
|
|
8
|
+
/**
|
|
9
|
+
* StatusbarModel represents a 4-column status bar component.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class StatusbarModel {
|
|
13
|
+
private readonly state;
|
|
14
|
+
private constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Create a new statusbar with column colors.
|
|
17
|
+
* @param first - Color configuration for the first column
|
|
18
|
+
* @param second - Color configuration for the second column
|
|
19
|
+
* @param third - Color configuration for the third column
|
|
20
|
+
* @param fourth - Color configuration for the fourth column
|
|
21
|
+
* @returns A new StatusbarModel instance
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
static new(first: ColorConfig, second: ColorConfig, third: ColorConfig, fourth: ColorConfig): StatusbarModel;
|
|
25
|
+
/**
|
|
26
|
+
* Set the total width of the statusbar.
|
|
27
|
+
* @param width - The total width in characters
|
|
28
|
+
* @returns A new StatusbarModel with updated width
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
setSize(width: number): StatusbarModel;
|
|
32
|
+
/**
|
|
33
|
+
* Set text content for all columns.
|
|
34
|
+
* @param first - Text for the first column
|
|
35
|
+
* @param second - Text for the second column
|
|
36
|
+
* @param third - Text for the third column
|
|
37
|
+
* @param fourth - Text for the fourth column
|
|
38
|
+
* @returns A new StatusbarModel with updated content
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
setContent(first: string, second: string, third: string, fourth: string): StatusbarModel;
|
|
42
|
+
/**
|
|
43
|
+
* Update colors for all columns.
|
|
44
|
+
* @param first - Color configuration for the first column
|
|
45
|
+
* @param second - Color configuration for the second column
|
|
46
|
+
* @param third - Color configuration for the third column
|
|
47
|
+
* @param fourth - Color configuration for the fourth column
|
|
48
|
+
* @returns A new StatusbarModel with updated colors
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
setColors(first: ColorConfig, second: ColorConfig, third: ColorConfig, fourth: ColorConfig): StatusbarModel;
|
|
52
|
+
/**
|
|
53
|
+
* Handle messages (primarily window resize).
|
|
54
|
+
* @param msg - The message to handle
|
|
55
|
+
* @returns A tuple of the updated model and command
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
update(msg: Msg): [StatusbarModel, Cmd<Msg>];
|
|
59
|
+
/**
|
|
60
|
+
* Render the statusbar as a string.
|
|
61
|
+
* @returns The rendered statusbar
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
view(): string;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC;IACvB,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IACtD,IAAI,cAAc,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,cAAc,EAAE,CAAC;YAC9C,MAAM;QACR,CAAC;QACD,MAAM,IAAI,IAAI,CAAC;IACjB,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,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
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@suds-cli/statusbar",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Status bar component for Suds terminal UIs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@suds-cli/chapstick": "0.1.0-alpha.0",
|
|
13
|
+
"@suds-cli/tea": "0.0.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"typescript": "5.8.2",
|
|
17
|
+
"vitest": "^4.0.15"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20.0.0"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"clean": "rm -rf dist",
|
|
24
|
+
"build": "pnpm run clean && tsc -p ./tsconfig.json",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"generate:api-report": "api-extractor run --local",
|
|
27
|
+
"check:api-report": "pnpm run generate:api-report",
|
|
28
|
+
"check:eslint": "pnpm run lint",
|
|
29
|
+
"lint": "eslint \"{src,test}/**/*.{ts,tsx}\""
|
|
30
|
+
}
|
|
31
|
+
}
|