@visulima/ansi 4.0.0-alpha.13 → 4.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE.md +0 -3
- package/README.md +3 -0
- package/dist/alternative-screen.d.ts +71 -70
- package/dist/alternative-screen.js +1 -8
- package/dist/clear.d.ts +74 -73
- package/dist/clear.js +1 -10
- package/dist/cursor.d.ts +421 -406
- package/dist/cursor.js +1 -3
- package/dist/erase.d.ts +193 -192
- package/dist/erase.js +1 -47
- package/dist/hyperlink.d.ts +25 -25
- package/dist/hyperlink.js +1 -5
- package/dist/image.d.ts +71 -70
- package/dist/image.js +1 -40
- package/dist/index.d.ts +65 -35
- package/dist/index.js +1 -26
- package/dist/iterm2.d.ts +285 -58
- package/dist/iterm2.js +1 -12
- package/dist/mode.d.ts +585 -584
- package/dist/mode.js +1 -245
- package/dist/mouse.d.ts +227 -226
- package/dist/mouse.js +1 -106
- package/dist/packem_shared/IT2_AUTO-OiB8EaxU.js +1 -0
- package/dist/packem_shared/ITerm2File-XoC8RMzs.js +1 -0
- package/dist/packem_shared/constants-D12jy2Zh.js +1 -0
- package/dist/packem_shared/cursor-BAcJR4p_.js +1 -0
- package/dist/packem_shared/resetProgressBar-H_gzPKNE.js +1 -0
- package/dist/packem_shared/restoreCursor-CHy0jZuu.js +2 -0
- package/dist/passthrough.d.ts +74 -73
- package/dist/passthrough.js +1 -29
- package/dist/reset.d.ts +25 -24
- package/dist/reset.js +1 -4
- package/dist/screen.d.ts +226 -225
- package/dist/screen.js +1 -27
- package/dist/scroll.d.ts +64 -63
- package/dist/scroll.js +1 -18
- package/dist/status.d.ts +521 -520
- package/dist/status.js +1 -95
- package/dist/strip.d.ts +1 -1
- package/dist/strip.js +1 -13
- package/dist/termcap.d.ts +36 -35
- package/dist/termcap.js +1 -25
- package/dist/title.d.ts +176 -175
- package/dist/title.js +1 -19
- package/dist/window-ops.d.ts +399 -398
- package/dist/window-ops.js +1 -61
- package/dist/xterm.d.ts +85 -84
- package/dist/xterm.js +1 -33
- package/package.json +2 -5
- package/dist/constants.d.ts +0 -20
- package/dist/helpers.d.ts +0 -14
- package/dist/iterm2/iterm2-properties.d.ts +0 -135
- package/dist/iterm2/iterm2-sequences.d.ts +0 -96
- package/dist/packem_shared/IT2_AUTO-DyYWsxno.js +0 -6
- package/dist/packem_shared/ITerm2File-CUZDBk99.js +0 -137
- package/dist/packem_shared/constants-CE7WkXh_.js +0 -9
- package/dist/packem_shared/cursor-ChpV7cgs.js +0 -72
- package/dist/packem_shared/resetProgressBar-D9r2s7eV.js +0 -18
- package/dist/packem_shared/restoreCursor-GfYEeJqN.js +0 -323
- package/dist/progress.d.ts +0 -41
package/dist/status.js
CHANGED
|
@@ -1,95 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class AnsiStatusReportImpl {
|
|
4
|
-
constructor(reportCode) {
|
|
5
|
-
this.reportCode = reportCode;
|
|
6
|
-
}
|
|
7
|
-
reportCode;
|
|
8
|
-
isDecReport = false;
|
|
9
|
-
}
|
|
10
|
-
class DecStatusReportImpl {
|
|
11
|
-
constructor(reportCode) {
|
|
12
|
-
this.reportCode = reportCode;
|
|
13
|
-
}
|
|
14
|
-
reportCode;
|
|
15
|
-
isDecReport = true;
|
|
16
|
-
}
|
|
17
|
-
const createAnsiStatusReport = (code) => new AnsiStatusReportImpl(code);
|
|
18
|
-
const createDecStatusReport = (code) => new DecStatusReportImpl(code);
|
|
19
|
-
const deviceStatusReport = (...reports) => {
|
|
20
|
-
if (reports.length === 0) {
|
|
21
|
-
return "";
|
|
22
|
-
}
|
|
23
|
-
const hasDecReport = reports.some((report) => report.isDecReport);
|
|
24
|
-
const reportCodes = reports.map((report) => report.reportCode.toString());
|
|
25
|
-
let seq = CSI;
|
|
26
|
-
if (hasDecReport) {
|
|
27
|
-
seq += "?";
|
|
28
|
-
}
|
|
29
|
-
return `${seq}${reportCodes.join(SEP)}n`;
|
|
30
|
-
};
|
|
31
|
-
const DSR = (report) => deviceStatusReport(report);
|
|
32
|
-
const requestCursorPositionReport = `${CSI}6n`;
|
|
33
|
-
const requestExtendedCursorPositionReport = `${CSI}?6n`;
|
|
34
|
-
const cursorPositionReport = (line, column) => {
|
|
35
|
-
const r = Math.max(1, line);
|
|
36
|
-
const c = Math.max(1, column);
|
|
37
|
-
return `${CSI}${r.toString()}${SEP}${c.toString()}R`;
|
|
38
|
-
};
|
|
39
|
-
const CPR = cursorPositionReport;
|
|
40
|
-
const extendedCursorPositionReport = (line, column, page) => {
|
|
41
|
-
const r = Math.max(1, line);
|
|
42
|
-
const c = Math.max(1, column);
|
|
43
|
-
let seq = `${CSI}?`;
|
|
44
|
-
seq += r.toString() + SEP + c.toString();
|
|
45
|
-
if (page > 0) {
|
|
46
|
-
seq += SEP + page.toString();
|
|
47
|
-
}
|
|
48
|
-
seq += "R";
|
|
49
|
-
return seq;
|
|
50
|
-
};
|
|
51
|
-
const DECXCPR = extendedCursorPositionReport;
|
|
52
|
-
const RequestNameVersion = `${CSI}>0q`;
|
|
53
|
-
const XTVERSION = RequestNameVersion;
|
|
54
|
-
const requestPrimaryDeviceAttributes = `${CSI}c`;
|
|
55
|
-
const DA1 = requestPrimaryDeviceAttributes;
|
|
56
|
-
const reportPrimaryDeviceAttributes = (...attributes) => {
|
|
57
|
-
if (attributes.length === 0) {
|
|
58
|
-
return "";
|
|
59
|
-
}
|
|
60
|
-
return `${CSI}?${attributes.join(SEP)}c`;
|
|
61
|
-
};
|
|
62
|
-
const requestSecondaryDeviceAttributes = `${CSI}>c`;
|
|
63
|
-
const DA2 = requestSecondaryDeviceAttributes;
|
|
64
|
-
const reportSecondaryDeviceAttributes = (version, level, cartridge = 0) => {
|
|
65
|
-
const pv = Math.max(0, version);
|
|
66
|
-
const pl = Math.max(0, level);
|
|
67
|
-
const pc = Math.max(0, cartridge);
|
|
68
|
-
return `${CSI}>${String(pv)}${SEP}${String(pl)}${SEP}${String(pc)}c`;
|
|
69
|
-
};
|
|
70
|
-
const requestTertiaryDeviceAttributes = `${CSI}=c`;
|
|
71
|
-
const DA3 = requestTertiaryDeviceAttributes;
|
|
72
|
-
const reportTertiaryDeviceAttributes = (unitID) => `${DCS}!|${unitID}${ST}`;
|
|
73
|
-
const requestPrimaryDeviceAttributesParam0 = `${CSI}0c`;
|
|
74
|
-
const requestSecondaryDeviceAttributesParam0 = `${CSI}>0c`;
|
|
75
|
-
const requestTertiaryDeviceAttributesParam0 = `${CSI}=0c`;
|
|
76
|
-
const requestTerminalStatus = createAnsiStatusReport(5);
|
|
77
|
-
const DSR_TerminalStatus = deviceStatusReport(requestTerminalStatus);
|
|
78
|
-
const reportTerminalOK = `${CSI}0n`;
|
|
79
|
-
const reportTerminalNotOK = `${CSI}3n`;
|
|
80
|
-
const requestPrinterStatusDEC = createDecStatusReport(15);
|
|
81
|
-
const DSR_PrinterStatusDEC = deviceStatusReport(requestPrinterStatusDEC);
|
|
82
|
-
const reportPrinterReadyDEC = `${CSI}?10n`;
|
|
83
|
-
const reportPrinterNotReadyDEC = `${CSI}?11n`;
|
|
84
|
-
const reportPrinterNoPaperDEC = `${CSI}?13n`;
|
|
85
|
-
const requestUDKStatusDEC = createDecStatusReport(25);
|
|
86
|
-
const DSR_UDKStatusDEC = deviceStatusReport(requestUDKStatusDEC);
|
|
87
|
-
const reportUDKLockedDEC = `${CSI}?20n`;
|
|
88
|
-
const reportUDKUnlockedDEC = `${CSI}?21n`;
|
|
89
|
-
const requestKeyboardLanguageDEC = createDecStatusReport(26);
|
|
90
|
-
const DSR_KeyboardLanguageDEC = deviceStatusReport(requestKeyboardLanguageDEC);
|
|
91
|
-
const reportKeyboardLanguageDEC = (langCode) => `${CSI}?27${SEP}${langCode.toString()}n`;
|
|
92
|
-
const RequestLightDarkReport = `${CSI}?996n`;
|
|
93
|
-
const LightDarkReport = (dark) => `${CSI}?997${SEP}${dark ? "1" : "2"}n`;
|
|
94
|
-
|
|
95
|
-
export { CPR, DA1, DA2, DA3, DECXCPR, DSR, DSR_KeyboardLanguageDEC, DSR_PrinterStatusDEC, DSR_TerminalStatus, DSR_UDKStatusDEC, LightDarkReport, RequestLightDarkReport, RequestNameVersion, XTVERSION, createAnsiStatusReport, createDecStatusReport, cursorPositionReport, deviceStatusReport, extendedCursorPositionReport, reportKeyboardLanguageDEC, reportPrimaryDeviceAttributes, reportPrinterNoPaperDEC, reportPrinterNotReadyDEC, reportPrinterReadyDEC, reportSecondaryDeviceAttributes, reportTerminalNotOK, reportTerminalOK, reportTertiaryDeviceAttributes, reportUDKLockedDEC, reportUDKUnlockedDEC, requestCursorPositionReport, requestExtendedCursorPositionReport, requestKeyboardLanguageDEC, requestPrimaryDeviceAttributes, requestPrimaryDeviceAttributesParam0, requestPrinterStatusDEC, requestSecondaryDeviceAttributes, requestSecondaryDeviceAttributesParam0, requestTerminalStatus, requestTertiaryDeviceAttributes, requestTertiaryDeviceAttributesParam0, requestUDKStatusDEC };
|
|
1
|
+
var $=Object.defineProperty;var D=(t,r)=>$(t,"name",{value:r,configurable:!0});import{C as e,S as i,D as S,a as R}from"./packem_shared/constants-D12jy2Zh.js";var C=Object.defineProperty,o=D((t,r)=>C(t,"name",{value:r,configurable:!0}),"e");class m{static{D(this,"x")}constructor(r){this.reportCode=r}reportCode;static{o(this,"AnsiStatusReportImpl")}isDecReport=!1}class d{static{D(this,"m")}constructor(r){this.reportCode=r}reportCode;static{o(this,"DecStatusReportImpl")}isDecReport=!0}const g=o(t=>new m(t),"createAnsiStatusReport"),p=o(t=>new d(t),"createDecStatusReport"),c=o((...t)=>{if(t.length===0)return"";const r=t.some(n=>n.isDecReport),a=t.map(n=>n.reportCode.toString());let s=e;return r&&(s+="?"),`${s}${a.join(i)}n`},"deviceStatusReport"),L=o(t=>c(t),"DSR"),M=`${e}6n`,f=`${e}?6n`,P=o((t,r)=>{const a=Math.max(1,t),s=Math.max(1,r);return`${e}${a.toString()}${i}${s.toString()}R`},"cursorPositionReport"),k=P,y=o((t,r,a)=>{const s=Math.max(1,t),n=Math.max(1,r);let u=`${e}?`;return u+=s.toString()+i+n.toString(),a>0&&(u+=i+a.toString()),u+="R",u},"extendedCursorPositionReport"),N=y,b=`${e}>0q`,U=b,A=`${e}c`,I=A,O=o((...t)=>t.length===0?"":`${e}?${t.join(i)}c`,"reportPrimaryDeviceAttributes"),v=`${e}>c`,_=v,j=o((t,r,a=0)=>{const s=Math.max(0,t),n=Math.max(0,r),u=Math.max(0,a);return`${e}>${String(s)}${i}${String(n)}${i}${String(u)}c`},"reportSecondaryDeviceAttributes"),E=`${e}=c`,w=E,V=o(t=>`${S}!|${t}${R}`,"reportTertiaryDeviceAttributes"),X=`${e}0c`,z=`${e}>0c`,B=`${e}=0c`,h=g(5),F=c(h),G=`${e}0n`,H=`${e}3n`,l=p(15),J=c(l),Q=`${e}?10n`,W=`${e}?11n`,Y=`${e}?13n`,q=p(25),Z=c(q),tt=`${e}?20n`,et=`${e}?21n`,x=p(26),rt=c(x),ot=o(t=>`${e}?27${i}${t.toString()}n`,"reportKeyboardLanguageDEC"),it=`${e}?996n`,at=o(t=>`${e}?997${i}${t?"1":"2"}n`,"LightDarkReport");export{k as CPR,I as DA1,_ as DA2,w as DA3,N as DECXCPR,L as DSR,rt as DSR_KeyboardLanguageDEC,J as DSR_PrinterStatusDEC,F as DSR_TerminalStatus,Z as DSR_UDKStatusDEC,at as LightDarkReport,it as RequestLightDarkReport,b as RequestNameVersion,U as XTVERSION,g as createAnsiStatusReport,p as createDecStatusReport,P as cursorPositionReport,c as deviceStatusReport,y as extendedCursorPositionReport,ot as reportKeyboardLanguageDEC,O as reportPrimaryDeviceAttributes,Y as reportPrinterNoPaperDEC,W as reportPrinterNotReadyDEC,Q as reportPrinterReadyDEC,j as reportSecondaryDeviceAttributes,H as reportTerminalNotOK,G as reportTerminalOK,V as reportTertiaryDeviceAttributes,tt as reportUDKLockedDEC,et as reportUDKUnlockedDEC,M as requestCursorPositionReport,f as requestExtendedCursorPositionReport,x as requestKeyboardLanguageDEC,A as requestPrimaryDeviceAttributes,X as requestPrimaryDeviceAttributesParam0,l as requestPrinterStatusDEC,v as requestSecondaryDeviceAttributes,z as requestSecondaryDeviceAttributesParam0,h as requestTerminalStatus,E as requestTertiaryDeviceAttributes,B as requestTertiaryDeviceAttributesParam0,q as requestUDKStatusDEC};
|
package/dist/strip.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare const strip: (input: string) => string;
|
|
2
|
-
export default
|
|
2
|
+
export { strip as default };
|
package/dist/strip.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
function
|
|
2
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
3
|
-
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
4
|
-
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
5
|
-
const pattern = `${osc}|${csi}`;
|
|
6
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const regex = ansiRegex();
|
|
10
|
-
const OSC_TITLE_REGEX = /\u001B\]0;.*\u0007/;
|
|
11
|
-
const strip = (input) => input.replace(OSC_TITLE_REGEX, "").replace(regex, "");
|
|
12
|
-
|
|
13
|
-
export { strip as default };
|
|
1
|
+
var n=Object.defineProperty;var u=(e,r)=>n(e,"name",{value:r,configurable:!0});var t=Object.defineProperty,c=u((e,r)=>t(e,"name",{value:r,configurable:!0}),"e");function a({onlyFirst:e=!1}={}){const r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,e?void 0:"g")}u(a,"t");c(a,"ansiRegex");var o=Object.defineProperty,i=u((e,r)=>o(e,"name",{value:r,configurable:!0}),"r");const s=a(),l=/\u001B\]0;.*\u0007/,d=i(e=>e.replace(l,"").replace(s,""),"strip");export{d as default};
|
package/dist/termcap.d.ts
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
* Requests Termcap/Terminfo (XTGETTCAP) strings from the terminal.
|
|
3
|
+
* Sequence: `DCS + q Pt ST`.
|
|
4
|
+
* @param caps A list of termcap/terminfo capability names (e.g., "Co", "li", "cols").
|
|
5
|
+
* @returns The XTGETTCAP sequence string.
|
|
6
|
+
* @see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Device-Control-Strings-plus-q
|
|
7
|
+
*/
|
|
8
|
+
declare const XTGETTCAP: (...caps: string[]) => string;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
* Alias for {@link XTGETTCAP}.
|
|
11
|
+
* Requests Termcap/Terminfo capability strings from the terminal.
|
|
12
|
+
* @param caps A list of Termcap/Terminfo capability names.
|
|
13
|
+
* @returns The XTGETTCAP escape sequence string.
|
|
14
|
+
* @see XTGETTCAP
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { requestTermcap } from "@visulima/ansi";
|
|
18
|
+
*
|
|
19
|
+
* const seq = requestTermcap("Co", "li"); // Requests colors and lines
|
|
20
|
+
* process.stdout.write(seq);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const requestTermcap: (...caps: string[]) => string;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
25
|
+
* Alias for {@link XTGETTCAP}.
|
|
26
|
+
* Requests Termcap/Terminfo capability strings from the terminal.
|
|
27
|
+
* @param caps A list of Termcap/Terminfo capability names.
|
|
28
|
+
* @returns The XTGETTCAP escape sequence string.
|
|
29
|
+
* @see XTGETTCAP
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { requestTerminfo } from "@visulima/ansi";
|
|
33
|
+
*
|
|
34
|
+
* const seq = requestTerminfo("Co", "li"); // Requests colors and lines
|
|
35
|
+
* process.stdout.write(seq);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare const requestTerminfo: (...caps: string[]) => string;
|
|
39
|
+
export { XTGETTCAP, requestTermcap, requestTerminfo };
|
package/dist/termcap.js
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const stringToHex = (input) => {
|
|
4
|
-
let hex = "";
|
|
5
|
-
for (let index = 0; index < input.length; index += 1) {
|
|
6
|
-
const charCode = input.codePointAt(index);
|
|
7
|
-
if (charCode === void 0) {
|
|
8
|
-
continue;
|
|
9
|
-
}
|
|
10
|
-
const byteHex = charCode.toString(16).toUpperCase();
|
|
11
|
-
hex += byteHex.length === 1 ? `0${byteHex}` : byteHex;
|
|
12
|
-
}
|
|
13
|
-
return hex;
|
|
14
|
-
};
|
|
15
|
-
const XTGETTCAP = (...caps) => {
|
|
16
|
-
if (caps.length === 0) {
|
|
17
|
-
return "";
|
|
18
|
-
}
|
|
19
|
-
const hexCaps = caps.map((cap) => stringToHex(cap));
|
|
20
|
-
return `${DCS}+q${hexCaps.join(SEP)}${ST}`;
|
|
21
|
-
};
|
|
22
|
-
const requestTermcap = XTGETTCAP;
|
|
23
|
-
const requestTerminfo = XTGETTCAP;
|
|
24
|
-
|
|
25
|
-
export { XTGETTCAP, requestTermcap, requestTerminfo };
|
|
1
|
+
var c=Object.defineProperty;var i=(e,t)=>c(e,"name",{value:t,configurable:!0});import{D as T,a as u,S as f}from"./packem_shared/constants-D12jy2Zh.js";var l=Object.defineProperty,s=i((e,t)=>l(e,"name",{value:t,configurable:!0}),"o");const p=s(e=>{let t="";for(let r=0;r<e.length;r+=1){const o=e.codePointAt(r);if(o===void 0)continue;const n=o.toString(16).toUpperCase();t+=n.length===1?`0${n}`:n}return t},"stringToHex"),a=s((...e)=>{if(e.length===0)return"";const t=e.map(r=>p(r));return`${T}+q${t.join(f)}${u}`},"XTGETTCAP"),P=a,S=a;export{a as XTGETTCAP,P as requestTermcap,S as requestTerminfo};
|
package/dist/title.d.ts
CHANGED
|
@@ -1,183 +1,184 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
* Sets the icon name and window title using an OSC (Operating System Command) sequence.
|
|
3
|
+
* This typically affects the title shown in the window's title bar and the name used for the icon
|
|
4
|
+
* when the window is minimized or in a taskbar.
|
|
5
|
+
*
|
|
6
|
+
* Uses the sequence: `OSC 0 ; title BEL`
|
|
7
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
8
|
+
* - `0`: Parameter indicating to set both icon name and window title.
|
|
9
|
+
* - `title`: The string to set.
|
|
10
|
+
* - `BEL`: Bell character (`\x07`) as terminator.
|
|
11
|
+
* @param title The string to be set as both the icon name and the window title.
|
|
12
|
+
* @returns The ANSI escape sequence for setting the icon name and window title.
|
|
13
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { setIconNameAndWindowTitle } from "@visulima/ansi";
|
|
17
|
+
*
|
|
18
|
+
* process.stdout.write(setIconNameAndWindowTitle("My Application"));
|
|
19
|
+
* // Sends: "\x1b]0;My Application\x07"
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const setIconNameAndWindowTitle: (title: string) => string;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
24
|
+
* Sets the icon name using an OSC (Operating System Command) sequence.
|
|
25
|
+
* This affects the name used for the icon when the window is minimized or in a taskbar.
|
|
26
|
+
*
|
|
27
|
+
* Uses the sequence: `OSC 1 ; iconName BEL`
|
|
28
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
29
|
+
* - `1`: Parameter indicating to set only the icon name.
|
|
30
|
+
* - `iconName`: The string to set as the icon name.
|
|
31
|
+
* - `BEL`: Bell character (`\x07`) as terminator.
|
|
32
|
+
* @param iconName The string to be set as the icon name.
|
|
33
|
+
* @returns The ANSI escape sequence for setting the icon name.
|
|
34
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import { setIconName } from "@visulima/ansi";
|
|
38
|
+
*
|
|
39
|
+
* process.stdout.write(setIconName("AppIcon"));
|
|
40
|
+
* // Sends: "\x1b]1;AppIcon\x07"
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const setIconName: (iconName: string) => string;
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
45
|
+
* Sets the window title using an OSC (Operating System Command) sequence.
|
|
46
|
+
* This affects the title shown in the window's title bar.
|
|
47
|
+
*
|
|
48
|
+
* Uses the sequence: `OSC 2 ; title BEL`
|
|
49
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
50
|
+
* - `2`: Parameter indicating to set only the window title.
|
|
51
|
+
* - `title`: The string to set as the window title.
|
|
52
|
+
* - `BEL`: Bell character (`\x07`) as terminator.
|
|
53
|
+
* @param title The string to be set as the window title.
|
|
54
|
+
* @returns The ANSI escape sequence for setting the window title.
|
|
55
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { setWindowTitle } from "@visulima/ansi";
|
|
59
|
+
*
|
|
60
|
+
* process.stdout.write(setWindowTitle("Current Document - Editor"));
|
|
61
|
+
* // Sends: "\x1b]2;Current Document - Editor\x07"
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const setWindowTitle: (title: string) => string;
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
66
|
+
* Sets a DEC Special Window Title (DECSWT) using an OSC sequence.
|
|
67
|
+
*
|
|
68
|
+
* DECSWT was introduced in the DEC VT520/VT525 family and uses the dedicated
|
|
69
|
+
* OSC code `21` (not to be confused with OSC 2 for standard window titles).
|
|
70
|
+
* It is terminated with ST (String Terminator) per the VT520 specification.
|
|
71
|
+
*
|
|
72
|
+
* Uses the sequence: `OSC 21 ; title ST`
|
|
73
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
74
|
+
* - `21`: Parameter for DEC Special Window Title.
|
|
75
|
+
* - `title`: The string to set.
|
|
76
|
+
* - `ST`: String Terminator (`\x1b\\`).
|
|
77
|
+
*
|
|
78
|
+
* Support varies across modern emulators; Zutty 0.6+ claims VT520 compatibility,
|
|
79
|
+
* and Microsoft's Windows Terminal also supports this sequence.
|
|
80
|
+
* Unsupported sequences are typically silently ignored by most terminals.
|
|
81
|
+
* @param title The title string.
|
|
82
|
+
* @returns The ANSI escape sequence for DECSWT.
|
|
83
|
+
* @see EK-VT520-RM 5–134 (VT520 Programmer Reference Manual)
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { decswt } from "@visulima/ansi";
|
|
87
|
+
*
|
|
88
|
+
* process.stdout.write(decswt("My Special Window"));
|
|
89
|
+
* // Sends: "\x1b]21;My Special Window\x1b\\"
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
declare const decswt: (title: string) => string;
|
|
93
93
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
94
|
+
* Sets a DEC Special Icon Name (DECSIN) using an OSC sequence.
|
|
95
|
+
*
|
|
96
|
+
* DECSIN was introduced in the DEC VT520/VT525 family and uses the dedicated
|
|
97
|
+
* OSC code `2L` (not to be confused with OSC 1 for standard icon names).
|
|
98
|
+
* It is terminated with ST (String Terminator) per the VT520 specification.
|
|
99
|
+
*
|
|
100
|
+
* Uses the sequence: `OSC 2L ; name ST`
|
|
101
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
102
|
+
* - `2L`: Parameter for DEC Special Icon Name.
|
|
103
|
+
* - `name`: The string to set.
|
|
104
|
+
* - `ST`: String Terminator (`\x1b\\`).
|
|
105
|
+
*
|
|
106
|
+
* Support varies across modern emulators; Zutty 0.6+ claims VT520 compatibility,
|
|
107
|
+
* and Microsoft's Windows Terminal also supports this sequence.
|
|
108
|
+
* Unsupported sequences are typically silently ignored by most terminals.
|
|
109
|
+
* @param name The name or content for the DEC-style icon name.
|
|
110
|
+
* @returns The ANSI escape sequence for DECSIN.
|
|
111
|
+
* @see EK-VT520-RM 5–134 (VT520 Programmer Reference Manual)
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* import { decsin } from "@visulima/ansi";
|
|
115
|
+
*
|
|
116
|
+
* process.stdout.write(decsin("SpecialIcon"));
|
|
117
|
+
* // Sends: "\x1b]2L;SpecialIcon\x1b\\"
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
declare const decsin: (name: string) => string;
|
|
121
121
|
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
122
|
+
* Sets the icon name and window title using an OSC sequence, terminated with ST (String Terminator).
|
|
123
|
+
* This is an alternative to the BEL-terminated version.
|
|
124
|
+
*
|
|
125
|
+
* Uses the sequence: `OSC 0 ; title ST`
|
|
126
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
127
|
+
* - `0`: Parameter indicating to set both icon name and window title.
|
|
128
|
+
* - `title`: The string to set.
|
|
129
|
+
* - `ST`: String Terminator (`\x1b\\`).
|
|
130
|
+
* @param title The string to be set as both the icon name and the window title.
|
|
131
|
+
* @returns The ANSI escape sequence for setting the icon name and window title, using ST.
|
|
132
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* import { setIconNameAndWindowTitleWithST } from "@visulima/ansi";
|
|
136
|
+
*
|
|
137
|
+
* process.stdout.write(setIconNameAndWindowTitleWithST("My App ST"));
|
|
138
|
+
* // Sends: "\x1b]0;My App ST\x1b\\"
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
declare const setIconNameAndWindowTitleWithST: (title: string) => string;
|
|
142
142
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
143
|
+
* Sets the icon name using an OSC sequence, terminated with ST (String Terminator).
|
|
144
|
+
* This is an alternative to the BEL-terminated version.
|
|
145
|
+
*
|
|
146
|
+
* Uses the sequence: `OSC 1 ; iconName ST`
|
|
147
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
148
|
+
* - `1`: Parameter indicating to set only the icon name.
|
|
149
|
+
* - `iconName`: The string to set as the icon name.
|
|
150
|
+
* - `ST`: String Terminator (`\x1b\\`).
|
|
151
|
+
* @param iconName The string to be set as the icon name.
|
|
152
|
+
* @returns The ANSI escape sequence for setting the icon name, using ST.
|
|
153
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* import { setIconNameWithST } from "@visulima/ansi";
|
|
157
|
+
*
|
|
158
|
+
* process.stdout.write(setIconNameWithST("AppIcon ST"));
|
|
159
|
+
* // Sends: "\x1b]1;AppIcon ST\x1b\\"
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
declare const setIconNameWithST: (iconName: string) => string;
|
|
163
163
|
/**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
164
|
+
* Sets the window title using an OSC sequence, terminated with ST (String Terminator).
|
|
165
|
+
* This is an alternative to the BEL-terminated version.
|
|
166
|
+
*
|
|
167
|
+
* Uses the sequence: `OSC 2 ; title ST`
|
|
168
|
+
* - `OSC`: Operating System Command (`\x1b]`).
|
|
169
|
+
* - `2`: Parameter indicating to set only the window title.
|
|
170
|
+
* - `title`: The string to set as the window title.
|
|
171
|
+
* - `ST`: String Terminator (`\x1b\\`).
|
|
172
|
+
* @param title The string to be set as the window title.
|
|
173
|
+
* @returns The ANSI escape sequence for setting the window title, using ST.
|
|
174
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands Xterm OSC documentation}
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* import { setWindowTitleWithST } from "@visulima/ansi";
|
|
178
|
+
*
|
|
179
|
+
* process.stdout.write(setWindowTitleWithST("Document ST - Editor"));
|
|
180
|
+
* // Sends: "\x1b]2;Document ST - Editor\x1b\\"
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
declare const setWindowTitleWithST: (title: string) => string;
|
|
184
|
+
export { decsin, decswt, setIconName, setIconNameAndWindowTitle, setIconNameAndWindowTitleWithST, setIconNameWithST, setWindowTitle, setWindowTitleWithST };
|
package/dist/title.js
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const TITLE_SANITIZE_REGEX = /[\u0007\u001B]/g;
|
|
4
|
-
const validateTitle = (title) => {
|
|
5
|
-
if (typeof title !== "string") {
|
|
6
|
-
throw new TypeError("Title must be a string");
|
|
7
|
-
}
|
|
8
|
-
return title.replaceAll(TITLE_SANITIZE_REGEX, "");
|
|
9
|
-
};
|
|
10
|
-
const setIconNameAndWindowTitle = (title) => `${OSC}0;${validateTitle(title)}${BEL}`;
|
|
11
|
-
const setIconName = (iconName) => `${OSC}1;${iconName}${BEL}`;
|
|
12
|
-
const setWindowTitle = (title) => `${OSC}2;${title}${BEL}`;
|
|
13
|
-
const decswt = (title) => `${OSC}21;${title}${ST}`;
|
|
14
|
-
const decsin = (name) => `${OSC}2L;${name}${ST}`;
|
|
15
|
-
const setIconNameAndWindowTitleWithST = (title) => `${OSC}0;${title}${ST}`;
|
|
16
|
-
const setIconNameWithST = (iconName) => `${OSC}1;${iconName}${ST}`;
|
|
17
|
-
const setWindowTitleWithST = (title) => `${OSC}2;${title}${ST}`;
|
|
18
|
-
|
|
19
|
-
export { decsin, decswt, setIconName, setIconNameAndWindowTitle, setIconNameAndWindowTitleWithST, setIconNameWithST, setWindowTitle, setWindowTitleWithST };
|
|
1
|
+
var r=Object.defineProperty;var a=(e,$)=>r(e,"name",{value:$,configurable:!0});import{O as i,a as o,B as s}from"./packem_shared/constants-D12jy2Zh.js";var d=Object.defineProperty,t=a((e,$)=>d(e,"name",{value:$,configurable:!0}),"n");const T=/[\u0007\u001B]/g,n=t(e=>{if(typeof e!="string")throw new TypeError("Title must be a string");return e.replaceAll(T,"")},"validateTitle"),W=t(e=>`${i}0;${n(e)}${s}`,"setIconNameAndWindowTitle"),m=t(e=>`${i}1;${n(e)}${s}`,"setIconName"),w=t(e=>`${i}2;${n(e)}${s}`,"setWindowTitle"),I=t(e=>`${i}21;${n(e)}${o}`,"decswt"),N=t(e=>`${i}2L;${n(e)}${o}`,"decsin"),S=t(e=>`${i}0;${n(e)}${o}`,"setIconNameAndWindowTitleWithST"),h=t(e=>`${i}1;${n(e)}${o}`,"setIconNameWithST"),u=t(e=>`${i}2;${n(e)}${o}`,"setWindowTitleWithST");export{N as decsin,I as decswt,m as setIconName,W as setIconNameAndWindowTitle,S as setIconNameAndWindowTitleWithST,h as setIconNameWithST,w as setWindowTitle,u as setWindowTitleWithST};
|