@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
45 lines • 1.57 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const terminal_kit_1 = __importDefault(require("terminal-kit"));
const TkBaseWidget_1 = __importDefault(require("./TkBaseWidget"));
const termKit = terminal_kit_1.default;
class TkProgressBarWidget extends TkBaseWidget_1.default {
type = 'progressBar';
bar;
constructor(options) {
super(options);
const { parent, label, left, top, progress, ...barOptions } = options;
this.bar = new termKit.Bar({
parent: parent?.getTermKitElement(),
content: label ? ` ${label}` : undefined,
x: left,
y: top,
barChars: 'solid',
bodyAttr: { bgColor: 'yellow', dim: false, color: 'yellow' },
overTextFullAttr: { bgColor: 'yellow', color: 'black', dim: false },
overTextEmptyAttr: {
bgColor: 'yellow',
color: 'black',
dim: false,
},
value: progress,
...barOptions,
});
this.bar.__widget = this;
this.calculateSizeLockDeltas();
}
setProgress(progress) {
this.bar.setValue(progress);
}
setLabel(label) {
this.bar.setContent(label ? ` ${label}` : '');
}
getTermKitElement() {
return this.bar;
}
}
exports.default = TkProgressBarWidget;
//# sourceMappingURL=TkProgressBarWidget.js.map