UNPKG

@visulima/ansi

Version:

ANSI escape codes for some terminal swag.

32 lines (27 loc) 1.91 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 validateTitle = /* @__PURE__ */ __name((title) => { if (typeof title !== "string") { throw new TypeError("Title must be a string"); } return title.replaceAll(/[\u0007\u001B]/g, ""); }, "validateTitle"); const setIconNameAndWindowTitle = /* @__PURE__ */ __name((title) => `${constants.OSC}0;${validateTitle(title)}${constants.BEL}`, "setIconNameAndWindowTitle"); const setIconName = /* @__PURE__ */ __name((iconName) => `${constants.OSC}1;${iconName}${constants.BEL}`, "setIconName"); const setWindowTitle = /* @__PURE__ */ __name((title) => `${constants.OSC}2;${title}${constants.BEL}`, "setWindowTitle"); const decswt = /* @__PURE__ */ __name((title) => setWindowTitle(`1;${title}`), "decswt"); const decsin = /* @__PURE__ */ __name((name) => setWindowTitle(`L;${name}`), "decsin"); const setIconNameAndWindowTitleWithST = /* @__PURE__ */ __name((title) => `${constants.OSC}0;${title}${constants.ST}`, "setIconNameAndWindowTitleWithST"); const setIconNameWithST = /* @__PURE__ */ __name((iconName) => `${constants.OSC}1;${iconName}${constants.ST}`, "setIconNameWithST"); const setWindowTitleWithST = /* @__PURE__ */ __name((title) => `${constants.OSC}2;${title}${constants.ST}`, "setWindowTitleWithST"); exports.decsin = decsin; exports.decswt = decswt; exports.setIconName = setIconName; exports.setIconNameAndWindowTitle = setIconNameAndWindowTitle; exports.setIconNameAndWindowTitleWithST = setIconNameAndWindowTitleWithST; exports.setIconNameWithST = setIconNameWithST; exports.setWindowTitle = setWindowTitle; exports.setWindowTitleWithST = setWindowTitleWithST;