UNPKG

@visulima/ansi

Version:

ANSI escape codes for some terminal swag.

42 lines (37 loc) 2.44 kB
'use strict'; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); const constants = require('./packem_shared/constants-BK26O-46.cjs'); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); const insertLine = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + (count <= 1 ? "" : count)}L`, "insertLine"); const deleteLine = /* @__PURE__ */ __name((count = 1) => `${constants.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 `${constants.CSI + constants.SEP}r`; } return `${constants.CSI + topString + constants.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 `${constants.CSI + constants.SEP}s`; } return `${constants.CSI + leftString + constants.SEP + rightString}s`; }, "setLeftRightMargins"); const insertCharacter = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + (count <= 1 ? "" : count)}@`, "insertCharacter"); const deleteCharacter = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + (count <= 1 ? "" : count)}P`, "deleteCharacter"); const clearTabStop = /* @__PURE__ */ __name((mode = 0) => `${constants.CSI + mode}g`, "clearTabStop"); const requestPresentationStateReport = /* @__PURE__ */ __name((mode) => `${constants.CSI + mode}$u`, "requestPresentationStateReport"); const repeatPreviousCharacter = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + (count <= 1 ? "" : count)}b`, "repeatPreviousCharacter"); exports.clearTabStop = clearTabStop; exports.deleteCharacter = deleteCharacter; exports.deleteLine = deleteLine; exports.insertCharacter = insertCharacter; exports.insertLine = insertLine; exports.repeatPreviousCharacter = repeatPreviousCharacter; exports.requestPresentationStateReport = requestPresentationStateReport; exports.setLeftRightMargins = setLeftRightMargins; exports.setTopBottomMargins = setTopBottomMargins;