UNPKG

@visulima/ansi

Version:

ANSI escape codes for some terminal swag.

21 lines (18 loc) 1.48 kB
import { O as OSC, B as BEL, a as ST } from './packem_shared/constants-CE7WkXh_.mjs'; 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) => `${OSC}0;${validateTitle(title)}${BEL}`, "setIconNameAndWindowTitle"); const setIconName = /* @__PURE__ */ __name((iconName) => `${OSC}1;${iconName}${BEL}`, "setIconName"); const setWindowTitle = /* @__PURE__ */ __name((title) => `${OSC}2;${title}${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) => `${OSC}0;${title}${ST}`, "setIconNameAndWindowTitleWithST"); const setIconNameWithST = /* @__PURE__ */ __name((iconName) => `${OSC}1;${iconName}${ST}`, "setIconNameWithST"); const setWindowTitleWithST = /* @__PURE__ */ __name((title) => `${OSC}2;${title}${ST}`, "setWindowTitleWithST"); export { decsin, decswt, setIconName, setIconNameAndWindowTitle, setIconNameAndWindowTitleWithST, setIconNameWithST, setWindowTitle, setWindowTitleWithST };