@visulima/ansi 1.0.17 → 1.1.0
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 +37 -0
- package/LICENSE.md +76 -74
- package/README.md +336 -2
- package/dist/alternative-screen.cjs +11 -5
- package/dist/alternative-screen.d.cts +74 -4
- package/dist/alternative-screen.d.mts +74 -4
- package/dist/alternative-screen.d.ts +74 -4
- package/dist/alternative-screen.mjs +8 -4
- package/dist/clear.cjs +10 -18
- package/dist/clear.d.cts +77 -7
- package/dist/clear.d.mts +77 -7
- package/dist/clear.d.ts +77 -7
- package/dist/clear.mjs +8 -15
- package/dist/constants.d.cts +20 -0
- package/dist/constants.d.mts +20 -0
- package/dist/constants.d.ts +20 -0
- package/dist/cursor.cjs +20 -3
- package/dist/cursor.d.cts +436 -30
- package/dist/cursor.d.mts +436 -30
- package/dist/cursor.d.ts +436 -30
- package/dist/cursor.mjs +3 -3
- package/dist/erase.cjs +44 -13
- package/dist/erase.d.cts +206 -9
- package/dist/erase.d.mts +206 -9
- package/dist/erase.d.ts +206 -9
- package/dist/erase.mjs +40 -14
- package/dist/helpers.d.cts +14 -0
- package/dist/helpers.d.mts +14 -0
- package/dist/helpers.d.ts +14 -0
- package/dist/hyperlink.cjs +9 -0
- package/dist/hyperlink.d.cts +29 -0
- package/dist/hyperlink.d.mts +27 -0
- package/dist/hyperlink.d.ts +29 -0
- package/dist/hyperlink.mjs +7 -0
- package/dist/image.cjs +12 -5
- package/dist/image.d.cts +69 -58
- package/dist/image.d.mts +69 -58
- package/dist/image.d.ts +69 -58
- package/dist/image.mjs +10 -5
- package/dist/index.cjs +209 -11
- package/dist/index.d.cts +35 -12
- package/dist/index.d.mts +35 -12
- package/dist/index.d.ts +35 -12
- package/dist/index.mjs +20 -7
- package/dist/iterm2/iterm2-properties.d.cts +135 -0
- package/dist/iterm2/iterm2-properties.d.mts +135 -0
- package/dist/iterm2/iterm2-properties.d.ts +135 -0
- package/dist/iterm2/iterm2-sequences.d.cts +96 -0
- package/dist/iterm2/iterm2-sequences.d.mts +96 -0
- package/dist/iterm2/iterm2-sequences.d.ts +96 -0
- package/dist/iterm2.cjs +26 -0
- package/dist/iterm2.d.cts +58 -0
- package/dist/iterm2.d.mts +58 -0
- package/dist/iterm2.d.ts +58 -0
- package/dist/iterm2.mjs +14 -0
- package/dist/mode.cjs +388 -0
- package/dist/mode.d.cts +657 -0
- package/dist/mode.d.mts +657 -0
- package/dist/mode.d.ts +657 -0
- package/dist/mode.mjs +235 -0
- package/dist/mouse.cjs +127 -0
- package/dist/mouse.d.cts +230 -0
- package/dist/mouse.d.mts +230 -0
- package/dist/mouse.d.ts +230 -0
- package/dist/mouse.mjs +108 -0
- package/dist/packem_shared/IT2_AUTO-5vTJQMm6.cjs +15 -0
- package/dist/packem_shared/IT2_AUTO-DnfCUXso.mjs +8 -0
- package/dist/packem_shared/ITerm2File-BGPqNSjB.cjs +137 -0
- package/dist/packem_shared/ITerm2File-DKFkdqdA.mjs +130 -0
- package/dist/packem_shared/{constants-D8u2npjW.cjs → constants-BK26O-46.cjs} +4 -0
- package/dist/packem_shared/constants-CE7WkXh_.mjs +9 -0
- package/dist/packem_shared/cursor-CQKLCu7U.cjs +105 -0
- package/dist/packem_shared/cursor-DhFQcQ9g.mjs +73 -0
- package/dist/packem_shared/{restoreCursor-UYYzYxTZ.mjs → restoreCursor-C6pNB8UY.mjs} +4 -21
- package/dist/packem_shared/{restoreCursor-Bjacc7pa.cjs → restoreCursor-DC_ZKZwT.cjs} +4 -21
- package/dist/passthrough.cjs +38 -0
- package/dist/passthrough.d.cts +77 -0
- package/dist/passthrough.d.mts +77 -0
- package/dist/passthrough.d.ts +77 -0
- package/dist/passthrough.mjs +31 -0
- package/dist/reset.cjs +9 -0
- package/dist/reset.d.cts +26 -0
- package/dist/reset.d.mts +26 -0
- package/dist/reset.d.ts +26 -0
- package/dist/reset.mjs +4 -0
- package/dist/screen.cjs +41 -0
- package/dist/screen.d.cts +234 -0
- package/dist/screen.d.mts +234 -0
- package/dist/screen.d.ts +234 -0
- package/dist/screen.mjs +29 -0
- package/dist/scroll.cjs +17 -3
- package/dist/scroll.d.cts +67 -4
- package/dist/scroll.d.mts +67 -4
- package/dist/scroll.d.ts +67 -4
- package/dist/scroll.mjs +16 -4
- package/dist/status.cjs +147 -0
- package/dist/status.d.cts +501 -0
- package/dist/status.d.mts +501 -0
- package/dist/status.d.ts +501 -0
- package/dist/status.mjs +104 -0
- package/dist/strip.cjs +1 -1
- package/dist/strip.d.cts +23 -1
- package/dist/strip.d.mts +22 -2
- package/dist/strip.d.ts +23 -1
- package/dist/strip.mjs +1 -1
- package/dist/termcap.cjs +33 -0
- package/dist/termcap.d.cts +38 -0
- package/dist/termcap.d.mts +38 -0
- package/dist/termcap.d.ts +38 -0
- package/dist/termcap.mjs +27 -0
- package/dist/title.cjs +31 -0
- package/dist/title.d.cts +185 -0
- package/dist/title.d.mts +185 -0
- package/dist/title.d.ts +185 -0
- package/dist/title.mjs +20 -0
- package/dist/window-ops.cjs +85 -0
- package/dist/window-ops.d.cts +418 -0
- package/dist/window-ops.d.mts +418 -0
- package/dist/window-ops.d.ts +418 -0
- package/dist/window-ops.mjs +63 -0
- package/dist/xterm.cjs +48 -0
- package/dist/xterm.d.cts +94 -0
- package/dist/xterm.d.mts +94 -0
- package/dist/xterm.d.ts +94 -0
- package/dist/xterm.mjs +35 -0
- package/package.json +153 -9
- package/dist/link.cjs +0 -9
- package/dist/link.d.cts +0 -3
- package/dist/link.d.mts +0 -3
- package/dist/link.d.ts +0 -3
- package/dist/link.mjs +0 -7
- package/dist/packem_shared/constants-CqXMfQy0.mjs +0 -7
- package/dist/packem_shared/cursor-BzPDI1bk.mjs +0 -42
- package/dist/packem_shared/cursor-DSN9nA2g.cjs +0 -57
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const node_buffer = require('node:buffer');
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
const formatITerm2FileProperties = /* @__PURE__ */ __name((properties) => {
|
|
10
|
+
const options = [];
|
|
11
|
+
if (properties.name) {
|
|
12
|
+
options.push(`name=${properties.name}`);
|
|
13
|
+
}
|
|
14
|
+
if (properties.size !== void 0) {
|
|
15
|
+
options.push(`size=${properties.size}`);
|
|
16
|
+
}
|
|
17
|
+
if (properties.width !== void 0) {
|
|
18
|
+
options.push(`width=${properties.width.toString()}`);
|
|
19
|
+
}
|
|
20
|
+
if (properties.height !== void 0) {
|
|
21
|
+
options.push(`height=${properties.height.toString()}`);
|
|
22
|
+
}
|
|
23
|
+
if (properties.ignoreAspectRatio) {
|
|
24
|
+
options.push("preserveAspectRatio=0");
|
|
25
|
+
}
|
|
26
|
+
if (properties.inline) {
|
|
27
|
+
options.push("inline=1");
|
|
28
|
+
}
|
|
29
|
+
if (properties.doNotMoveCursor) {
|
|
30
|
+
options.push("doNotMoveCursor=1");
|
|
31
|
+
}
|
|
32
|
+
return options.join(";");
|
|
33
|
+
}, "formatITerm2FileProperties");
|
|
34
|
+
class ITerm2File {
|
|
35
|
+
static {
|
|
36
|
+
__name(this, "ITerm2File");
|
|
37
|
+
}
|
|
38
|
+
fileProps;
|
|
39
|
+
/**
|
|
40
|
+
* Constructs an `ITerm2File` payload object.
|
|
41
|
+
* @param properties An object containing properties for the file/image, as defined by {@link ITerm2FileProps}.
|
|
42
|
+
* The `name` property within `props` should be pre-Base64 encoded by the caller if it might
|
|
43
|
+
* contain special characters (like `;`, `=`, or non-ASCII characters).
|
|
44
|
+
* If `fileData` is provided, `props.content` will be overridden, and `props.size` will be
|
|
45
|
+
* set from `fileData.byteLength` if not already present in `props`.
|
|
46
|
+
* @param fileData (Optional) A `Uint8Array` containing the raw file data. If provided, this data will be
|
|
47
|
+
* Base64 encoded and used as the `content` of the file transfer. The `size` property
|
|
48
|
+
* will also be automatically set from `fileData.byteLength` if not specified in `props`.
|
|
49
|
+
*/
|
|
50
|
+
constructor(properties, fileData) {
|
|
51
|
+
this.fileProps = { ...properties };
|
|
52
|
+
if (fileData) {
|
|
53
|
+
if (fileData.byteLength > 10 * 1024 * 1024) {
|
|
54
|
+
throw new Error("File size exceeds maximum limit of 10MB");
|
|
55
|
+
}
|
|
56
|
+
this.fileProps.content = node_buffer.Buffer.from(fileData).toString("base64");
|
|
57
|
+
if (this.fileProps.size === void 0) {
|
|
58
|
+
this.fileProps.size = fileData.byteLength;
|
|
59
|
+
}
|
|
60
|
+
if (this.fileProps.size !== fileData.byteLength) {
|
|
61
|
+
throw new Error("File size property doesn't match actual data length");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Converts the file properties and its content (if any) into the string payload
|
|
67
|
+
* suitable for the iTerm2 `File=` command.
|
|
68
|
+
* @returns The string payload (e.g., `"File=name=...;size=...:BASE64_CONTENT"` or `"File=name=...;size=..."`).
|
|
69
|
+
*/
|
|
70
|
+
toString() {
|
|
71
|
+
let s = "File=";
|
|
72
|
+
s += formatITerm2FileProperties(this.fileProps);
|
|
73
|
+
if (this.fileProps.content !== void 0) {
|
|
74
|
+
s += `:${this.fileProps.content}`;
|
|
75
|
+
}
|
|
76
|
+
return s;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class ITerm2FileEnd {
|
|
80
|
+
static {
|
|
81
|
+
__name(this, "ITerm2FileEnd");
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Generates the string payload for the iTerm2 `FileEnd` command.
|
|
85
|
+
* @returns The string `"FileEnd"`.
|
|
86
|
+
*/
|
|
87
|
+
// eslint-disable-next-line class-methods-use-this
|
|
88
|
+
toString() {
|
|
89
|
+
return "FileEnd";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
class ITerm2FilePart {
|
|
93
|
+
/**
|
|
94
|
+
* Constructs an `ITerm2FilePart` payload object.
|
|
95
|
+
* @param base64Chunk A string containing a Base64 encoded chunk of the file data.
|
|
96
|
+
* The caller is responsible for chunking the file and Base64 encoding each chunk.
|
|
97
|
+
*/
|
|
98
|
+
constructor(base64Chunk) {
|
|
99
|
+
this.base64Chunk = base64Chunk;
|
|
100
|
+
}
|
|
101
|
+
static {
|
|
102
|
+
__name(this, "ITerm2FilePart");
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Converts the Base64 encoded chunk into the string payload suitable for the iTerm2 `FilePart=` command.
|
|
106
|
+
* @returns The string payload (e.g., `"FilePart=U09NRURBVEE="`).
|
|
107
|
+
*/
|
|
108
|
+
toString() {
|
|
109
|
+
return `FilePart=${this.base64Chunk}`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
class ITerm2MultipartFileStart {
|
|
113
|
+
/**
|
|
114
|
+
* Constructs an `ITerm2MultipartFileStart` payload object.
|
|
115
|
+
* @param properties Properties for the multipart file (e.g., `name`, `size`). Content is not part of this command.
|
|
116
|
+
* The `name` property within `props` should be pre-Base64 encoded by the caller if it might
|
|
117
|
+
* contain special characters.
|
|
118
|
+
*/
|
|
119
|
+
constructor(properties) {
|
|
120
|
+
this.properties = properties;
|
|
121
|
+
}
|
|
122
|
+
static {
|
|
123
|
+
__name(this, "ITerm2MultipartFileStart");
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Converts the file properties into the string payload suitable for the iTerm2 `MultipartFile=` command.
|
|
127
|
+
* @returns The string payload (e.g., `"MultipartFile=name=...;size=..."`).
|
|
128
|
+
*/
|
|
129
|
+
toString() {
|
|
130
|
+
return `MultipartFile=${formatITerm2FileProperties(this.properties)}`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
exports.ITerm2File = ITerm2File;
|
|
135
|
+
exports.ITerm2FileEnd = ITerm2FileEnd;
|
|
136
|
+
exports.ITerm2FilePart = ITerm2FilePart;
|
|
137
|
+
exports.ITerm2MultipartFileStart = ITerm2MultipartFileStart;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const formatITerm2FileProperties = /* @__PURE__ */ __name((properties) => {
|
|
6
|
+
const options = [];
|
|
7
|
+
if (properties.name) {
|
|
8
|
+
options.push(`name=${properties.name}`);
|
|
9
|
+
}
|
|
10
|
+
if (properties.size !== void 0) {
|
|
11
|
+
options.push(`size=${properties.size}`);
|
|
12
|
+
}
|
|
13
|
+
if (properties.width !== void 0) {
|
|
14
|
+
options.push(`width=${properties.width.toString()}`);
|
|
15
|
+
}
|
|
16
|
+
if (properties.height !== void 0) {
|
|
17
|
+
options.push(`height=${properties.height.toString()}`);
|
|
18
|
+
}
|
|
19
|
+
if (properties.ignoreAspectRatio) {
|
|
20
|
+
options.push("preserveAspectRatio=0");
|
|
21
|
+
}
|
|
22
|
+
if (properties.inline) {
|
|
23
|
+
options.push("inline=1");
|
|
24
|
+
}
|
|
25
|
+
if (properties.doNotMoveCursor) {
|
|
26
|
+
options.push("doNotMoveCursor=1");
|
|
27
|
+
}
|
|
28
|
+
return options.join(";");
|
|
29
|
+
}, "formatITerm2FileProperties");
|
|
30
|
+
class ITerm2File {
|
|
31
|
+
static {
|
|
32
|
+
__name(this, "ITerm2File");
|
|
33
|
+
}
|
|
34
|
+
fileProps;
|
|
35
|
+
/**
|
|
36
|
+
* Constructs an `ITerm2File` payload object.
|
|
37
|
+
* @param properties An object containing properties for the file/image, as defined by {@link ITerm2FileProps}.
|
|
38
|
+
* The `name` property within `props` should be pre-Base64 encoded by the caller if it might
|
|
39
|
+
* contain special characters (like `;`, `=`, or non-ASCII characters).
|
|
40
|
+
* If `fileData` is provided, `props.content` will be overridden, and `props.size` will be
|
|
41
|
+
* set from `fileData.byteLength` if not already present in `props`.
|
|
42
|
+
* @param fileData (Optional) A `Uint8Array` containing the raw file data. If provided, this data will be
|
|
43
|
+
* Base64 encoded and used as the `content` of the file transfer. The `size` property
|
|
44
|
+
* will also be automatically set from `fileData.byteLength` if not specified in `props`.
|
|
45
|
+
*/
|
|
46
|
+
constructor(properties, fileData) {
|
|
47
|
+
this.fileProps = { ...properties };
|
|
48
|
+
if (fileData) {
|
|
49
|
+
if (fileData.byteLength > 10 * 1024 * 1024) {
|
|
50
|
+
throw new Error("File size exceeds maximum limit of 10MB");
|
|
51
|
+
}
|
|
52
|
+
this.fileProps.content = Buffer.from(fileData).toString("base64");
|
|
53
|
+
if (this.fileProps.size === void 0) {
|
|
54
|
+
this.fileProps.size = fileData.byteLength;
|
|
55
|
+
}
|
|
56
|
+
if (this.fileProps.size !== fileData.byteLength) {
|
|
57
|
+
throw new Error("File size property doesn't match actual data length");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Converts the file properties and its content (if any) into the string payload
|
|
63
|
+
* suitable for the iTerm2 `File=` command.
|
|
64
|
+
* @returns The string payload (e.g., `"File=name=...;size=...:BASE64_CONTENT"` or `"File=name=...;size=..."`).
|
|
65
|
+
*/
|
|
66
|
+
toString() {
|
|
67
|
+
let s = "File=";
|
|
68
|
+
s += formatITerm2FileProperties(this.fileProps);
|
|
69
|
+
if (this.fileProps.content !== void 0) {
|
|
70
|
+
s += `:${this.fileProps.content}`;
|
|
71
|
+
}
|
|
72
|
+
return s;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class ITerm2FileEnd {
|
|
76
|
+
static {
|
|
77
|
+
__name(this, "ITerm2FileEnd");
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Generates the string payload for the iTerm2 `FileEnd` command.
|
|
81
|
+
* @returns The string `"FileEnd"`.
|
|
82
|
+
*/
|
|
83
|
+
// eslint-disable-next-line class-methods-use-this
|
|
84
|
+
toString() {
|
|
85
|
+
return "FileEnd";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
class ITerm2FilePart {
|
|
89
|
+
/**
|
|
90
|
+
* Constructs an `ITerm2FilePart` payload object.
|
|
91
|
+
* @param base64Chunk A string containing a Base64 encoded chunk of the file data.
|
|
92
|
+
* The caller is responsible for chunking the file and Base64 encoding each chunk.
|
|
93
|
+
*/
|
|
94
|
+
constructor(base64Chunk) {
|
|
95
|
+
this.base64Chunk = base64Chunk;
|
|
96
|
+
}
|
|
97
|
+
static {
|
|
98
|
+
__name(this, "ITerm2FilePart");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Converts the Base64 encoded chunk into the string payload suitable for the iTerm2 `FilePart=` command.
|
|
102
|
+
* @returns The string payload (e.g., `"FilePart=U09NRURBVEE="`).
|
|
103
|
+
*/
|
|
104
|
+
toString() {
|
|
105
|
+
return `FilePart=${this.base64Chunk}`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
class ITerm2MultipartFileStart {
|
|
109
|
+
/**
|
|
110
|
+
* Constructs an `ITerm2MultipartFileStart` payload object.
|
|
111
|
+
* @param properties Properties for the multipart file (e.g., `name`, `size`). Content is not part of this command.
|
|
112
|
+
* The `name` property within `props` should be pre-Base64 encoded by the caller if it might
|
|
113
|
+
* contain special characters.
|
|
114
|
+
*/
|
|
115
|
+
constructor(properties) {
|
|
116
|
+
this.properties = properties;
|
|
117
|
+
}
|
|
118
|
+
static {
|
|
119
|
+
__name(this, "ITerm2MultipartFileStart");
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Converts the file properties into the string payload suitable for the iTerm2 `MultipartFile=` command.
|
|
123
|
+
* @returns The string payload (e.g., `"MultipartFile=name=...;size=..."`).
|
|
124
|
+
*/
|
|
125
|
+
toString() {
|
|
126
|
+
return `MultipartFile=${formatITerm2FileProperties(this.properties)}`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export { ITerm2File, ITerm2FileEnd, ITerm2FilePart, ITerm2MultipartFileStart };
|
|
@@ -5,9 +5,13 @@ const CSI = `${ESC}[`;
|
|
|
5
5
|
const OSC = "\x1B]";
|
|
6
6
|
const BEL = "\x07";
|
|
7
7
|
const SEP = ";";
|
|
8
|
+
const DCS = `${ESC}P`;
|
|
9
|
+
const ST = `${ESC}\\`;
|
|
8
10
|
|
|
9
11
|
exports.BEL = BEL;
|
|
10
12
|
exports.CSI = CSI;
|
|
13
|
+
exports.DCS = DCS;
|
|
11
14
|
exports.ESC = ESC;
|
|
12
15
|
exports.OSC = OSC;
|
|
13
16
|
exports.SEP = SEP;
|
|
17
|
+
exports.ST = ST;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const constants = require('./constants-BK26O-46.cjs');
|
|
4
|
+
require('./restoreCursor-DC_ZKZwT.cjs');
|
|
5
|
+
|
|
6
|
+
const isBrowser = globalThis?.window?.document !== void 0;
|
|
7
|
+
const isTerminalApp = !isBrowser && process.env.TERM_PROGRAM === "Apple_Terminal";
|
|
8
|
+
const isWindows = !isBrowser && (process.platform === "win32" || /^(?:msys|cygwin)$/.test(process.env.OSTYPE));
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
const SAVE_CURSOR_DEC = `${constants.ESC}7`;
|
|
13
|
+
const RESTORE_CURSOR_DEC = `${constants.ESC}8`;
|
|
14
|
+
const CURSOR_UP_1 = `${constants.CSI}A`;
|
|
15
|
+
const CURSOR_DOWN_1 = `${constants.CSI}B`;
|
|
16
|
+
const CURSOR_FORWARD_1 = `${constants.CSI}C`;
|
|
17
|
+
const CURSOR_BACKWARD_1 = `${constants.CSI}D`;
|
|
18
|
+
const REQUEST_CURSOR_POSITION = `${constants.CSI}6n`;
|
|
19
|
+
const REQUEST_EXTENDED_CURSOR_POSITION = `${constants.CSI}?6n`;
|
|
20
|
+
const cursorBackward = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}D`, "cursorBackward");
|
|
21
|
+
const cursorDown = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}B`, "cursorDown");
|
|
22
|
+
const cursorForward = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}C`, "cursorForward");
|
|
23
|
+
const cursorHide = `${constants.CSI}?25l`;
|
|
24
|
+
const cursorToColumn1 = `${constants.CSI}G`;
|
|
25
|
+
const cursorLeft = /* @__PURE__ */ __name((count = 1) => cursorBackward(count), "cursorLeft");
|
|
26
|
+
const cursorHorizontalAbsolute = /* @__PURE__ */ __name((column = 1) => `${constants.CSI + column}G`, "cursorHorizontalAbsolute");
|
|
27
|
+
const cursorMove = /* @__PURE__ */ __name((x, y) => {
|
|
28
|
+
let returnValue = "";
|
|
29
|
+
if (x < 0) {
|
|
30
|
+
returnValue += `${constants.CSI + -x}D`;
|
|
31
|
+
} else if (x > 0) {
|
|
32
|
+
returnValue += `${constants.CSI + x}C`;
|
|
33
|
+
}
|
|
34
|
+
if (y < 0) {
|
|
35
|
+
returnValue += `${constants.CSI + -y}A`;
|
|
36
|
+
} else if (y > 0) {
|
|
37
|
+
returnValue += `${constants.CSI + y}B`;
|
|
38
|
+
}
|
|
39
|
+
return returnValue;
|
|
40
|
+
}, "cursorMove");
|
|
41
|
+
const cursorNextLine = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}E`, "cursorNextLine");
|
|
42
|
+
const cursorPreviousLine = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}F`, "cursorPreviousLine");
|
|
43
|
+
const cursorRestore = isTerminalApp ? RESTORE_CURSOR_DEC : `${constants.ESC}u`;
|
|
44
|
+
const cursorSave = isTerminalApp ? SAVE_CURSOR_DEC : `${constants.ESC}s`;
|
|
45
|
+
const cursorShow = `${constants.CSI}?25h`;
|
|
46
|
+
const cursorTo = /* @__PURE__ */ __name((x, y) => {
|
|
47
|
+
if (y === void 0) {
|
|
48
|
+
return cursorHorizontalAbsolute(x + 1);
|
|
49
|
+
}
|
|
50
|
+
return `${constants.CSI + (y + 1) + constants.SEP + (x + 1)}H`;
|
|
51
|
+
}, "cursorTo");
|
|
52
|
+
const cursorPosition = /* @__PURE__ */ __name((row, column) => {
|
|
53
|
+
if (column === void 0) {
|
|
54
|
+
return `${constants.CSI + row}H`;
|
|
55
|
+
}
|
|
56
|
+
return `${constants.CSI + row + constants.SEP + column}H`;
|
|
57
|
+
}, "cursorPosition");
|
|
58
|
+
const cursorHorizontalForwardTab = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}I`, "cursorHorizontalForwardTab");
|
|
59
|
+
const cursorBackwardTab = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}Z`, "cursorBackwardTab");
|
|
60
|
+
const eraseCharacter = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}X`, "eraseCharacter");
|
|
61
|
+
const cursorVerticalAbsolute = /* @__PURE__ */ __name((row = 1) => `${constants.CSI + row}d`, "cursorVerticalAbsolute");
|
|
62
|
+
const cursorUp = /* @__PURE__ */ __name((count = 1) => `${constants.CSI + count}A`, "cursorUp");
|
|
63
|
+
var CursorStyle = /* @__PURE__ */ ((CursorStyle2) => {
|
|
64
|
+
CursorStyle2[CursorStyle2["BlinkingBar"] = 5] = "BlinkingBar";
|
|
65
|
+
CursorStyle2[CursorStyle2["BlinkingBlock"] = 1] = "BlinkingBlock";
|
|
66
|
+
CursorStyle2[CursorStyle2["BlinkingUnderline"] = 3] = "BlinkingUnderline";
|
|
67
|
+
CursorStyle2[CursorStyle2["Default"] = 0] = "Default";
|
|
68
|
+
CursorStyle2[CursorStyle2["SteadyBar"] = 6] = "SteadyBar";
|
|
69
|
+
CursorStyle2[CursorStyle2["SteadyBlock"] = 2] = "SteadyBlock";
|
|
70
|
+
CursorStyle2[CursorStyle2["SteadyUnderline"] = 4] = "SteadyUnderline";
|
|
71
|
+
return CursorStyle2;
|
|
72
|
+
})(CursorStyle || {});
|
|
73
|
+
const setCursorStyle = /* @__PURE__ */ __name((style) => `${constants.CSI + style} q`, "setCursorStyle");
|
|
74
|
+
|
|
75
|
+
exports.CURSOR_BACKWARD_1 = CURSOR_BACKWARD_1;
|
|
76
|
+
exports.CURSOR_DOWN_1 = CURSOR_DOWN_1;
|
|
77
|
+
exports.CURSOR_FORWARD_1 = CURSOR_FORWARD_1;
|
|
78
|
+
exports.CURSOR_UP_1 = CURSOR_UP_1;
|
|
79
|
+
exports.CursorStyle = CursorStyle;
|
|
80
|
+
exports.REQUEST_CURSOR_POSITION = REQUEST_CURSOR_POSITION;
|
|
81
|
+
exports.REQUEST_EXTENDED_CURSOR_POSITION = REQUEST_EXTENDED_CURSOR_POSITION;
|
|
82
|
+
exports.RESTORE_CURSOR_DEC = RESTORE_CURSOR_DEC;
|
|
83
|
+
exports.SAVE_CURSOR_DEC = SAVE_CURSOR_DEC;
|
|
84
|
+
exports.cursorBackward = cursorBackward;
|
|
85
|
+
exports.cursorBackwardTab = cursorBackwardTab;
|
|
86
|
+
exports.cursorDown = cursorDown;
|
|
87
|
+
exports.cursorForward = cursorForward;
|
|
88
|
+
exports.cursorHide = cursorHide;
|
|
89
|
+
exports.cursorHorizontalAbsolute = cursorHorizontalAbsolute;
|
|
90
|
+
exports.cursorHorizontalForwardTab = cursorHorizontalForwardTab;
|
|
91
|
+
exports.cursorLeft = cursorLeft;
|
|
92
|
+
exports.cursorMove = cursorMove;
|
|
93
|
+
exports.cursorNextLine = cursorNextLine;
|
|
94
|
+
exports.cursorPosition = cursorPosition;
|
|
95
|
+
exports.cursorPreviousLine = cursorPreviousLine;
|
|
96
|
+
exports.cursorRestore = cursorRestore;
|
|
97
|
+
exports.cursorSave = cursorSave;
|
|
98
|
+
exports.cursorShow = cursorShow;
|
|
99
|
+
exports.cursorTo = cursorTo;
|
|
100
|
+
exports.cursorToColumn1 = cursorToColumn1;
|
|
101
|
+
exports.cursorUp = cursorUp;
|
|
102
|
+
exports.cursorVerticalAbsolute = cursorVerticalAbsolute;
|
|
103
|
+
exports.eraseCharacter = eraseCharacter;
|
|
104
|
+
exports.isWindows = isWindows;
|
|
105
|
+
exports.setCursorStyle = setCursorStyle;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { C as CSI, E as ESC, S as SEP } from './constants-CE7WkXh_.mjs';
|
|
2
|
+
import './restoreCursor-C6pNB8UY.mjs';
|
|
3
|
+
|
|
4
|
+
const isBrowser = globalThis?.window?.document !== void 0;
|
|
5
|
+
const isTerminalApp = !isBrowser && process.env.TERM_PROGRAM === "Apple_Terminal";
|
|
6
|
+
const isWindows = !isBrowser && (process.platform === "win32" || /^(?:msys|cygwin)$/.test(process.env.OSTYPE));
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
+
const SAVE_CURSOR_DEC = `${ESC}7`;
|
|
11
|
+
const RESTORE_CURSOR_DEC = `${ESC}8`;
|
|
12
|
+
const CURSOR_UP_1 = `${CSI}A`;
|
|
13
|
+
const CURSOR_DOWN_1 = `${CSI}B`;
|
|
14
|
+
const CURSOR_FORWARD_1 = `${CSI}C`;
|
|
15
|
+
const CURSOR_BACKWARD_1 = `${CSI}D`;
|
|
16
|
+
const REQUEST_CURSOR_POSITION = `${CSI}6n`;
|
|
17
|
+
const REQUEST_EXTENDED_CURSOR_POSITION = `${CSI}?6n`;
|
|
18
|
+
const cursorBackward = /* @__PURE__ */ __name((count = 1) => `${CSI + count}D`, "cursorBackward");
|
|
19
|
+
const cursorDown = /* @__PURE__ */ __name((count = 1) => `${CSI + count}B`, "cursorDown");
|
|
20
|
+
const cursorForward = /* @__PURE__ */ __name((count = 1) => `${CSI + count}C`, "cursorForward");
|
|
21
|
+
const cursorHide = `${CSI}?25l`;
|
|
22
|
+
const cursorToColumn1 = `${CSI}G`;
|
|
23
|
+
const cursorLeft = /* @__PURE__ */ __name((count = 1) => cursorBackward(count), "cursorLeft");
|
|
24
|
+
const cursorHorizontalAbsolute = /* @__PURE__ */ __name((column = 1) => `${CSI + column}G`, "cursorHorizontalAbsolute");
|
|
25
|
+
const cursorMove = /* @__PURE__ */ __name((x, y) => {
|
|
26
|
+
let returnValue = "";
|
|
27
|
+
if (x < 0) {
|
|
28
|
+
returnValue += `${CSI + -x}D`;
|
|
29
|
+
} else if (x > 0) {
|
|
30
|
+
returnValue += `${CSI + x}C`;
|
|
31
|
+
}
|
|
32
|
+
if (y < 0) {
|
|
33
|
+
returnValue += `${CSI + -y}A`;
|
|
34
|
+
} else if (y > 0) {
|
|
35
|
+
returnValue += `${CSI + y}B`;
|
|
36
|
+
}
|
|
37
|
+
return returnValue;
|
|
38
|
+
}, "cursorMove");
|
|
39
|
+
const cursorNextLine = /* @__PURE__ */ __name((count = 1) => `${CSI + count}E`, "cursorNextLine");
|
|
40
|
+
const cursorPreviousLine = /* @__PURE__ */ __name((count = 1) => `${CSI + count}F`, "cursorPreviousLine");
|
|
41
|
+
const cursorRestore = isTerminalApp ? RESTORE_CURSOR_DEC : `${ESC}u`;
|
|
42
|
+
const cursorSave = isTerminalApp ? SAVE_CURSOR_DEC : `${ESC}s`;
|
|
43
|
+
const cursorShow = `${CSI}?25h`;
|
|
44
|
+
const cursorTo = /* @__PURE__ */ __name((x, y) => {
|
|
45
|
+
if (y === void 0) {
|
|
46
|
+
return cursorHorizontalAbsolute(x + 1);
|
|
47
|
+
}
|
|
48
|
+
return `${CSI + (y + 1) + SEP + (x + 1)}H`;
|
|
49
|
+
}, "cursorTo");
|
|
50
|
+
const cursorPosition = /* @__PURE__ */ __name((row, column) => {
|
|
51
|
+
if (column === void 0) {
|
|
52
|
+
return `${CSI + row}H`;
|
|
53
|
+
}
|
|
54
|
+
return `${CSI + row + SEP + column}H`;
|
|
55
|
+
}, "cursorPosition");
|
|
56
|
+
const cursorHorizontalForwardTab = /* @__PURE__ */ __name((count = 1) => `${CSI + count}I`, "cursorHorizontalForwardTab");
|
|
57
|
+
const cursorBackwardTab = /* @__PURE__ */ __name((count = 1) => `${CSI + count}Z`, "cursorBackwardTab");
|
|
58
|
+
const eraseCharacter = /* @__PURE__ */ __name((count = 1) => `${CSI + count}X`, "eraseCharacter");
|
|
59
|
+
const cursorVerticalAbsolute = /* @__PURE__ */ __name((row = 1) => `${CSI + row}d`, "cursorVerticalAbsolute");
|
|
60
|
+
const cursorUp = /* @__PURE__ */ __name((count = 1) => `${CSI + count}A`, "cursorUp");
|
|
61
|
+
var CursorStyle = /* @__PURE__ */ ((CursorStyle2) => {
|
|
62
|
+
CursorStyle2[CursorStyle2["BlinkingBar"] = 5] = "BlinkingBar";
|
|
63
|
+
CursorStyle2[CursorStyle2["BlinkingBlock"] = 1] = "BlinkingBlock";
|
|
64
|
+
CursorStyle2[CursorStyle2["BlinkingUnderline"] = 3] = "BlinkingUnderline";
|
|
65
|
+
CursorStyle2[CursorStyle2["Default"] = 0] = "Default";
|
|
66
|
+
CursorStyle2[CursorStyle2["SteadyBar"] = 6] = "SteadyBar";
|
|
67
|
+
CursorStyle2[CursorStyle2["SteadyBlock"] = 2] = "SteadyBlock";
|
|
68
|
+
CursorStyle2[CursorStyle2["SteadyUnderline"] = 4] = "SteadyUnderline";
|
|
69
|
+
return CursorStyle2;
|
|
70
|
+
})(CursorStyle || {});
|
|
71
|
+
const setCursorStyle = /* @__PURE__ */ __name((style) => `${CSI + style} q`, "setCursorStyle");
|
|
72
|
+
|
|
73
|
+
export { isWindows as A, CursorStyle as B, CURSOR_BACKWARD_1 as C, REQUEST_CURSOR_POSITION as R, SAVE_CURSOR_DEC as S, CURSOR_DOWN_1 as a, CURSOR_FORWARD_1 as b, CURSOR_UP_1 as c, cursorBackward as d, cursorBackwardTab as e, cursorDown as f, cursorForward as g, cursorHide as h, cursorHorizontalAbsolute as i, cursorHorizontalForwardTab as j, cursorLeft as k, cursorMove as l, cursorNextLine as m, cursorPosition as n, cursorPreviousLine as o, cursorRestore as p, cursorSave as q, cursorShow as r, cursorTo as s, cursorToColumn1 as t, cursorUp as u, cursorVerticalAbsolute as v, eraseCharacter as w, REQUEST_EXTENDED_CURSOR_POSITION as x, RESTORE_CURSOR_DEC as y, setCursorStyle as z };
|
|
@@ -17,7 +17,7 @@ const copyProperty = /* @__PURE__ */ __name$2((to, from, property, ignoreNonConf
|
|
|
17
17
|
Object.defineProperty(to, property, fromDescriptor);
|
|
18
18
|
}, "copyProperty");
|
|
19
19
|
const canCopyProperty = /* @__PURE__ */ __name$2(function(toDescriptor, fromDescriptor) {
|
|
20
|
-
return toDescriptor ===
|
|
20
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
21
21
|
}, "canCopyProperty");
|
|
22
22
|
const changePrototype = /* @__PURE__ */ __name$2((to, from) => {
|
|
23
23
|
const fromPrototype = Object.getPrototypeOf(from);
|
|
@@ -62,7 +62,7 @@ const onetime = /* @__PURE__ */ __name$1((function_, options = {}) => {
|
|
|
62
62
|
calledFunctions.set(onetime2, ++callCount);
|
|
63
63
|
if (callCount === 1) {
|
|
64
64
|
returnValue = function_.apply(this, arguments_);
|
|
65
|
-
function_ =
|
|
65
|
+
function_ = void 0;
|
|
66
66
|
} else if (options.throw === true) {
|
|
67
67
|
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
68
68
|
}
|
|
@@ -323,26 +323,9 @@ const {
|
|
|
323
323
|
*
|
|
324
324
|
* Returns a function that may be used to unload signal-exit.
|
|
325
325
|
*/
|
|
326
|
-
onExit
|
|
327
|
-
/**
|
|
328
|
-
* Load the listeners. Likely you never need to call this, unless
|
|
329
|
-
* doing a rather deep integration with signal-exit functionality.
|
|
330
|
-
* Mostly exposed for the benefit of testing.
|
|
331
|
-
*
|
|
332
|
-
* @internal
|
|
333
|
-
*/
|
|
334
|
-
load,
|
|
335
|
-
/**
|
|
336
|
-
* Unload the listeners. Likely you never need to call this, unless
|
|
337
|
-
* doing a rather deep integration with signal-exit functionality.
|
|
338
|
-
* Mostly exposed for the benefit of testing.
|
|
339
|
-
*
|
|
340
|
-
* @internal
|
|
341
|
-
*/
|
|
342
|
-
unload
|
|
343
|
-
} = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
326
|
+
onExit} = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
344
327
|
|
|
345
|
-
const terminal = process$2.stderr.isTTY ? process$2.stderr : process$2.stdout.isTTY ? process$2.stdout :
|
|
328
|
+
const terminal = process$2.stderr.isTTY ? process$2.stderr : process$2.stdout.isTTY ? process$2.stdout : void 0;
|
|
346
329
|
const restoreCursor = terminal ? onetime(() => {
|
|
347
330
|
onExit(() => {
|
|
348
331
|
terminal.write("\x1B[?25h");
|
|
@@ -23,7 +23,7 @@ const copyProperty = /* @__PURE__ */ __name$2((to, from, property, ignoreNonConf
|
|
|
23
23
|
Object.defineProperty(to, property, fromDescriptor);
|
|
24
24
|
}, "copyProperty");
|
|
25
25
|
const canCopyProperty = /* @__PURE__ */ __name$2(function(toDescriptor, fromDescriptor) {
|
|
26
|
-
return toDescriptor ===
|
|
26
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
27
27
|
}, "canCopyProperty");
|
|
28
28
|
const changePrototype = /* @__PURE__ */ __name$2((to, from) => {
|
|
29
29
|
const fromPrototype = Object.getPrototypeOf(from);
|
|
@@ -68,7 +68,7 @@ const onetime = /* @__PURE__ */ __name$1((function_, options = {}) => {
|
|
|
68
68
|
calledFunctions.set(onetime2, ++callCount);
|
|
69
69
|
if (callCount === 1) {
|
|
70
70
|
returnValue = function_.apply(this, arguments_);
|
|
71
|
-
function_ =
|
|
71
|
+
function_ = void 0;
|
|
72
72
|
} else if (options.throw === true) {
|
|
73
73
|
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
74
74
|
}
|
|
@@ -329,26 +329,9 @@ const {
|
|
|
329
329
|
*
|
|
330
330
|
* Returns a function that may be used to unload signal-exit.
|
|
331
331
|
*/
|
|
332
|
-
onExit
|
|
333
|
-
/**
|
|
334
|
-
* Load the listeners. Likely you never need to call this, unless
|
|
335
|
-
* doing a rather deep integration with signal-exit functionality.
|
|
336
|
-
* Mostly exposed for the benefit of testing.
|
|
337
|
-
*
|
|
338
|
-
* @internal
|
|
339
|
-
*/
|
|
340
|
-
load,
|
|
341
|
-
/**
|
|
342
|
-
* Unload the listeners. Likely you never need to call this, unless
|
|
343
|
-
* doing a rather deep integration with signal-exit functionality.
|
|
344
|
-
* Mostly exposed for the benefit of testing.
|
|
345
|
-
*
|
|
346
|
-
* @internal
|
|
347
|
-
*/
|
|
348
|
-
unload
|
|
349
|
-
} = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
332
|
+
onExit} = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
350
333
|
|
|
351
|
-
const terminal = process__default.stderr.isTTY ? process__default.stderr : process__default.stdout.isTTY ? process__default.stdout :
|
|
334
|
+
const terminal = process__default.stderr.isTTY ? process__default.stderr : process__default.stdout.isTTY ? process__default.stdout : void 0;
|
|
352
335
|
const restoreCursor = terminal ? onetime(() => {
|
|
353
336
|
onExit(() => {
|
|
354
337
|
terminal.write("\x1B[?25h");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const constants = require('./packem_shared/constants-BK26O-46.cjs');
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
const SCREEN_MAX_LEN_DEFAULT = 0;
|
|
10
|
+
const SCREEN_TYPICAL_LIMIT = 768;
|
|
11
|
+
const screenPassthrough = /* @__PURE__ */ __name((sequence, limit = SCREEN_MAX_LEN_DEFAULT) => {
|
|
12
|
+
let result = constants.DCS;
|
|
13
|
+
if (limit > 0 && sequence.length > limit) {
|
|
14
|
+
for (let index = 0; index < sequence.length; index += limit) {
|
|
15
|
+
const end = Math.min(index + limit, sequence.length);
|
|
16
|
+
result += sequence.slice(index, end);
|
|
17
|
+
if (end < sequence.length) {
|
|
18
|
+
result += constants.ST + constants.DCS;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
result += sequence;
|
|
23
|
+
}
|
|
24
|
+
result += constants.ST;
|
|
25
|
+
return result;
|
|
26
|
+
}, "screenPassthrough");
|
|
27
|
+
const tmuxPassthrough = /* @__PURE__ */ __name((sequence) => {
|
|
28
|
+
let escapedSequence = "";
|
|
29
|
+
for (const element of sequence) {
|
|
30
|
+
escapedSequence += element === constants.ESC ? constants.ESC + constants.ESC : element;
|
|
31
|
+
}
|
|
32
|
+
return `${constants.DCS}tmux;${escapedSequence}${constants.ST}`;
|
|
33
|
+
}, "tmuxPassthrough");
|
|
34
|
+
|
|
35
|
+
exports.SCREEN_MAX_LEN_DEFAULT = SCREEN_MAX_LEN_DEFAULT;
|
|
36
|
+
exports.SCREEN_TYPICAL_LIMIT = SCREEN_TYPICAL_LIMIT;
|
|
37
|
+
exports.screenPassthrough = screenPassthrough;
|
|
38
|
+
exports.tmuxPassthrough = tmuxPassthrough;
|