ink-hud 0.1.1 → 0.1.3
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 +18 -0
- package/dist/index.cjs +46 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +46 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -189,6 +189,23 @@ Real-time scrolling log display with syntax highlighting.
|
|
|
189
189
|
/>
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
+
#### PulseBar
|
|
193
|
+
Heartbeat-style connection status history.
|
|
194
|
+
|
|
195
|
+

|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
<PulseBar
|
|
199
|
+
records={[
|
|
200
|
+
{ status: 'good' },
|
|
201
|
+
{ status: 'unstable' },
|
|
202
|
+
{ status: 'bad' },
|
|
203
|
+
]}
|
|
204
|
+
maxBars={30}
|
|
205
|
+
variant="unicode"
|
|
206
|
+
/>
|
|
207
|
+
```
|
|
208
|
+
|
|
192
209
|
### Layout Components
|
|
193
210
|
|
|
194
211
|
#### Panel
|
|
@@ -250,6 +267,7 @@ pnpm install
|
|
|
250
267
|
npx tsx examples/dashboard.tsx
|
|
251
268
|
|
|
252
269
|
# Run individual components
|
|
270
|
+
npx tsx examples/basic/pulsebar.tsx
|
|
253
271
|
npx tsx examples/basic/linechart.tsx
|
|
254
272
|
npx tsx examples/basic/piechart.tsx
|
|
255
273
|
npx tsx examples/basic/table.tsx
|
package/dist/index.cjs
CHANGED
|
@@ -3015,6 +3015,51 @@ var Table = ({
|
|
|
3015
3015
|
})
|
|
3016
3016
|
);
|
|
3017
3017
|
};
|
|
3018
|
+
var CHAR_SETS3 = {
|
|
3019
|
+
unicode: {
|
|
3020
|
+
bar: "\u258C",
|
|
3021
|
+
left: "\u256D",
|
|
3022
|
+
right: "\u256E",
|
|
3023
|
+
leftBottom: "\u2570",
|
|
3024
|
+
rightBottom: "\u256F",
|
|
3025
|
+
horizontal: "\u2500",
|
|
3026
|
+
vertical: "\u2502"
|
|
3027
|
+
},
|
|
3028
|
+
ascii: {
|
|
3029
|
+
bar: "|",
|
|
3030
|
+
left: "/",
|
|
3031
|
+
right: "\\",
|
|
3032
|
+
leftBottom: "\\",
|
|
3033
|
+
rightBottom: "/",
|
|
3034
|
+
horizontal: "-",
|
|
3035
|
+
vertical: "|"
|
|
3036
|
+
}
|
|
3037
|
+
};
|
|
3038
|
+
var PulseBar = ({
|
|
3039
|
+
records = [],
|
|
3040
|
+
maxBars = 30,
|
|
3041
|
+
variant = "unicode",
|
|
3042
|
+
colors
|
|
3043
|
+
}) => {
|
|
3044
|
+
const theme = useTheme();
|
|
3045
|
+
const chars = CHAR_SETS3[variant];
|
|
3046
|
+
const getColor = (status) => {
|
|
3047
|
+
switch (status) {
|
|
3048
|
+
case "good":
|
|
3049
|
+
return colors?.good ?? theme.semantic.success;
|
|
3050
|
+
case "unstable":
|
|
3051
|
+
return colors?.unstable ?? theme.semantic.warning;
|
|
3052
|
+
case "bad":
|
|
3053
|
+
return colors?.bad ?? theme.semantic.error;
|
|
3054
|
+
}
|
|
3055
|
+
};
|
|
3056
|
+
const displayRecords = records.slice(-maxBars);
|
|
3057
|
+
const paddingCount = maxBars - displayRecords.length;
|
|
3058
|
+
const borderColor = theme.semantic.muted;
|
|
3059
|
+
const topBorder = chars.left + chars.horizontal.repeat(maxBars) + chars.right;
|
|
3060
|
+
const bottomBorder = chars.leftBottom + chars.horizontal.repeat(maxBars) + chars.rightBottom;
|
|
3061
|
+
return /* @__PURE__ */ React6__default.default.createElement(ink.Box, { flexDirection: "column" }, /* @__PURE__ */ React6__default.default.createElement(ink.Text, { color: borderColor }, topBorder), /* @__PURE__ */ React6__default.default.createElement(ink.Box, { flexDirection: "row" }, /* @__PURE__ */ React6__default.default.createElement(ink.Text, { color: borderColor }, chars.vertical), paddingCount > 0 && /* @__PURE__ */ React6__default.default.createElement(ink.Text, { color: borderColor }, chars.bar.repeat(paddingCount)), displayRecords.map((record, index) => /* @__PURE__ */ React6__default.default.createElement(ink.Text, { key: index, color: getColor(record.status) }, chars.bar)), /* @__PURE__ */ React6__default.default.createElement(ink.Text, { color: borderColor }, chars.vertical)), /* @__PURE__ */ React6__default.default.createElement(ink.Text, { color: borderColor }, bottomBorder));
|
|
3062
|
+
};
|
|
3018
3063
|
|
|
3019
3064
|
exports.AreaChart = AreaChart;
|
|
3020
3065
|
exports.AsciiRenderer = AsciiRenderer;
|
|
@@ -3034,6 +3079,7 @@ exports.LogStream = LogStream;
|
|
|
3034
3079
|
exports.ONE_DARK_THEME = ONE_DARK_THEME;
|
|
3035
3080
|
exports.Panel = Panel;
|
|
3036
3081
|
exports.PieChart = PieChart;
|
|
3082
|
+
exports.PulseBar = PulseBar;
|
|
3037
3083
|
exports.Renderer = Renderer;
|
|
3038
3084
|
exports.RendererSelector = RendererSelector;
|
|
3039
3085
|
exports.Sparkline = Sparkline;
|