@visulima/ansi
Version:
ANSI escape codes for some terminal swag.
30 lines (27 loc) • 1.93 kB
JavaScript
import { C as CSI, S as SEP } from './packem_shared/constants-CE7WkXh_.mjs';
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
const insertLine = /* @__PURE__ */ __name((count = 1) => `${CSI + (count <= 1 ? "" : count)}L`, "insertLine");
const deleteLine = /* @__PURE__ */ __name((count = 1) => `${CSI + (count <= 1 ? "" : count)}M`, "deleteLine");
const setTopBottomMargins = /* @__PURE__ */ __name((top, bottom) => {
const topString = top && top > 0 ? top.toString() : "";
const bottomString = bottom && bottom > 0 ? bottom.toString() : "";
if (topString === "" && bottomString === "") {
return `${CSI + SEP}r`;
}
return `${CSI + topString + SEP + bottomString}r`;
}, "setTopBottomMargins");
const setLeftRightMargins = /* @__PURE__ */ __name((left, right) => {
const leftString = left && left > 0 ? left.toString() : "";
const rightString = right && right > 0 ? right.toString() : "";
if (leftString === "" && rightString === "") {
return `${CSI + SEP}s`;
}
return `${CSI + leftString + SEP + rightString}s`;
}, "setLeftRightMargins");
const insertCharacter = /* @__PURE__ */ __name((count = 1) => `${CSI + (count <= 1 ? "" : count)}@`, "insertCharacter");
const deleteCharacter = /* @__PURE__ */ __name((count = 1) => `${CSI + (count <= 1 ? "" : count)}P`, "deleteCharacter");
const clearTabStop = /* @__PURE__ */ __name((mode = 0) => `${CSI + mode}g`, "clearTabStop");
const requestPresentationStateReport = /* @__PURE__ */ __name((mode) => `${CSI + mode}$u`, "requestPresentationStateReport");
const repeatPreviousCharacter = /* @__PURE__ */ __name((count = 1) => `${CSI + (count <= 1 ? "" : count)}b`, "repeatPreviousCharacter");
export { clearTabStop, deleteCharacter, deleteLine, insertCharacter, insertLine, repeatPreviousCharacter, requestPresentationStateReport, setLeftRightMargins, setTopBottomMargins };