zephyr-agent
Version:
Zephyr plugin agent
89 lines (88 loc) • 3.15 kB
JavaScript
;
var __webpack_require__ = {};
(()=>{
__webpack_require__.d = (exports1, getters, values)=>{
var define = (defs, kind)=>{
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
enumerable: true,
[kind]: defs[key]
});
};
define(getters, "get");
define(values, "value");
};
})();
(()=>{
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
__webpack_require__.r = (exports1)=>{
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
value: 'Module'
});
Object.defineProperty(exports1, '__esModule', {
value: true
});
};
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
showSuccessAnimation: ()=>showSuccessAnimation
});
const external_debug_js_namespaceObject = require("./debug.js");
const external_picocolor_js_namespaceObject = require("./picocolor.js");
const SPINNER_FRAMES = [
'⠋',
'⠙',
'⠹',
'⠸',
'⠼',
'⠴',
'⠦',
'⠧',
'⠇',
'⠏'
];
const SPIN_INTERVAL_MS = 100;
const SPIN_DURATION_MS = 900;
const SUCCESS_HOLD_MS = 250;
const hideCursor = ()=>process.stdout.write('\u001B[?25l');
const showCursor = ()=>process.stdout.write('\u001B[?25h');
const clearLine = ()=>process.stdout.write('\u001B[2K\r');
async function showSuccessAnimation(message = 'Build complete!') {
if (!external_picocolor_js_namespaceObject.isTTY || !process.stdout.isTTY) return;
return new Promise((resolve)=>{
let frameIndex = 0;
let timeout = null;
const formatLine = (symbol)=>`${external_debug_js_namespaceObject.brightBlueBgName} ${(0, external_picocolor_js_namespaceObject.purple)(symbol)} ${(0, external_picocolor_js_namespaceObject.purple)(message)}`;
const stopSpinner = ()=>{
clearInterval(interval);
if (timeout) clearTimeout(timeout);
};
const interval = setInterval(()=>{
clearLine();
process.stdout.write(formatLine(SPINNER_FRAMES[frameIndex]));
frameIndex = (frameIndex + 1) % SPINNER_FRAMES.length;
}, SPIN_INTERVAL_MS);
hideCursor();
timeout = setTimeout(()=>{
stopSpinner();
clearLine();
process.stdout.write(formatLine('✓'));
timeout = setTimeout(()=>{
process.stdout.write('\n');
showCursor();
resolve();
}, SUCCESS_HOLD_MS);
}, SPIN_DURATION_MS);
});
}
exports.showSuccessAnimation = __webpack_exports__.showSuccessAnimation;
for(var __rspack_i in __webpack_exports__)if (-1 === [
"showSuccessAnimation"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
value: true
});
//# sourceMappingURL=success-animation.js.map