@visulima/ansi 4.0.0-alpha.16 → 4.0.0-alpha.18
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 +65 -0
- package/LICENSE.md +0 -17
- package/README.md +38 -10
- package/dist/alternative-screen.js +1 -1
- package/dist/background.d.ts +72 -0
- package/dist/background.js +1 -0
- package/dist/charset.d.ts +52 -0
- package/dist/charset.js +1 -0
- package/dist/clear.js +1 -1
- package/dist/clipboard.d.ts +76 -0
- package/dist/clipboard.js +1 -0
- package/dist/constants.d.ts +28 -0
- package/dist/constants.js +1 -0
- package/dist/cursor.js +1 -1
- package/dist/cwd.d.ts +26 -0
- package/dist/cwd.js +1 -0
- package/dist/erase.js +1 -1
- package/dist/finalterm.d.ts +47 -0
- package/dist/finalterm.js +1 -0
- package/dist/focus.d.ts +20 -0
- package/dist/focus.js +1 -0
- package/dist/hyperlink.d.ts +25 -0
- package/dist/hyperlink.js +1 -1
- package/dist/image.d.ts +3 -4
- package/dist/image.js +1 -1
- package/dist/index.d.ts +16 -43
- package/dist/index.js +1 -1
- package/dist/iterm2.js +1 -1
- package/dist/keypad.d.ts +27 -0
- package/dist/keypad.js +1 -0
- package/dist/kitty-graphics.d.ts +17 -0
- package/dist/kitty-graphics.js +1 -0
- package/dist/mode.js +1 -1
- package/dist/mouse.js +1 -1
- package/dist/notification.d.ts +30 -0
- package/dist/notification.js +1 -0
- package/dist/packem_shared/IT2_AUTO-K3GubKy7.js +1 -0
- package/dist/packem_shared/ITerm2File-BkLc5ipB.js +1 -0
- package/dist/packem_shared/cursor-BXG1O_IE.js +1 -0
- package/dist/packem_shared/restoreCursor-CyaXIMQf.js +2 -0
- package/dist/passthrough.js +1 -1
- package/dist/paste.d.ts +23 -0
- package/dist/paste.js +1 -0
- package/dist/progress.d.ts +42 -0
- package/dist/progress.js +1 -0
- package/dist/screen.js +1 -1
- package/dist/scroll.js +1 -1
- package/dist/sixel.d.ts +19 -0
- package/dist/sixel.js +1 -0
- package/dist/status.js +1 -1
- package/dist/strip.d.ts +25 -0
- package/dist/strip.js +1 -1
- package/dist/termcap.js +1 -1
- package/dist/title.js +1 -1
- package/dist/urxvt.d.ts +15 -0
- package/dist/urxvt.js +1 -0
- package/dist/window-ops.js +1 -1
- package/dist/xterm.d.ts +83 -1
- package/dist/xterm.js +1 -1
- package/package.json +57 -1
- package/dist/packem_shared/IT2_AUTO-OiB8EaxU.js +0 -1
- package/dist/packem_shared/ITerm2File-XoC8RMzs.js +0 -1
- package/dist/packem_shared/constants-D12jy2Zh.js +0 -1
- package/dist/packem_shared/cursor-BAcJR4p_.js +0 -1
- package/dist/packem_shared/resetProgressBar-H_gzPKNE.js +0 -1
- package/dist/packem_shared/restoreCursor-CHy0jZuu.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,68 @@
|
|
|
1
|
+
## @visulima/ansi [4.0.0-alpha.18](https://github.com/visulima/visulima/compare/@visulima/ansi@4.0.0-alpha.17...@visulima/ansi@4.0.0-alpha.18) (2026-06-30)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **ansi:** add bracketed paste markers ([5dc3d57](https://github.com/visulima/visulima/commit/5dc3d579cd1887c3b949ffee875d7259d8a5879e))
|
|
6
|
+
* **ansi:** add character set selection (SCS) ([60852bd](https://github.com/visulima/visulima/commit/60852bd00920dc90c582adc298584a13e4f361a8))
|
|
7
|
+
* **ansi:** add desktop notification sequences ([36f0a69](https://github.com/visulima/visulima/commit/36f0a69191e502750c7e104838688edd249e837e))
|
|
8
|
+
* **ansi:** add FinalTerm shell integration marks (OSC 133) ([e087278](https://github.com/visulima/visulima/commit/e087278a25f5665172cbaa3f4dacd628ebd344ba))
|
|
9
|
+
* **ansi:** add focus event reporting sequences ([83718f7](https://github.com/visulima/visulima/commit/83718f770c6e5297a69675f3adea2ba9004b95aa))
|
|
10
|
+
* **ansi:** add foreground/background/cursor color sequences ([2c562bd](https://github.com/visulima/visulima/commit/2c562bdfb3a67168fd106b78159b4e98d6131f47))
|
|
11
|
+
* **ansi:** add keypad application/numeric mode sequences ([cc62e9d](https://github.com/visulima/visulima/commit/cc62e9d21c7043df0b101c967133ae0b335e2d83))
|
|
12
|
+
* **ansi:** add kitty graphics protocol sequence wrapper ([6e83b5c](https://github.com/visulima/visulima/commit/6e83b5cff7938ae38df8d9aa6e019453c89ae1ea))
|
|
13
|
+
* **ansi:** add sixel graphics sequence wrapper ([fb2a225](https://github.com/visulima/visulima/commit/fb2a225d10ad6008e0cdc6959128d30502536c2f))
|
|
14
|
+
* **ansi:** add urxvt OSC 777 extension ([8b96c1a](https://github.com/visulima/visulima/commit/8b96c1ac11c19c56fa3a55adff21309ad2287b43))
|
|
15
|
+
* **ansi:** add working directory reporting (OSC 7) ([95059d5](https://github.com/visulima/visulima/commit/95059d5462a416393937d5bbab6ca425397a22b4))
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **ansi:** strip OSC terminators from color/cwd/finalterm payloads ([6c4ab8c](https://github.com/visulima/visulima/commit/6c4ab8c4cae3f8bafd7483f161887883bb315a6b))
|
|
20
|
+
|
|
21
|
+
### Documentation
|
|
22
|
+
|
|
23
|
+
* **ansi:** document new escape sequence modules ([0bbc476](https://github.com/visulima/visulima/commit/0bbc4766259d9bde491186cadeb167d9e353f4dc))
|
|
24
|
+
|
|
25
|
+
### Styles
|
|
26
|
+
|
|
27
|
+
* cs fixes ([2a960bb](https://github.com/visulima/visulima/commit/2a960bb1772c9dc70080e2d75d3a0d827034e294))
|
|
28
|
+
|
|
29
|
+
### Miscellaneous Chores
|
|
30
|
+
|
|
31
|
+
* add fallow code-intelligence across all packages ([a3b4821](https://github.com/visulima/visulima/commit/a3b48215002e86fed20f2973038b5d4a0aa1ce04))
|
|
32
|
+
* **fallow:** resolve dead-code findings ([c4125d5](https://github.com/visulima/visulima/commit/c4125d53e03ac9d90115399634535991927a96cc))
|
|
33
|
+
|
|
34
|
+
### Code Refactoring
|
|
35
|
+
|
|
36
|
+
* **ansi:** share OSC terminator sanitizer; address review findings ([ed2215d](https://github.com/visulima/visulima/commit/ed2215d8a61e2896dae278c7a07eae393ed415ea))
|
|
37
|
+
|
|
38
|
+
### Continuous Integration
|
|
39
|
+
|
|
40
|
+
* **fallow:** make fallow:health advisory (--report-only) ([d57148e](https://github.com/visulima/visulima/commit/d57148ea0e3556b4c24d8d336b9fa14987f5dc7d))
|
|
41
|
+
|
|
42
|
+
## @visulima/ansi [4.0.0-alpha.17](https://github.com/visulima/visulima/compare/@visulima/ansi@4.0.0-alpha.16...@visulima/ansi@4.0.0-alpha.17) (2026-06-13)
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* **ansi:** add osc52 clipboard + kitty keyboard, harden strip ([793cc9e](https://github.com/visulima/visulima/commit/793cc9e848aabe4b7b637a855941eb1f40649c94))
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
49
|
+
|
|
50
|
+
* **ansi:** strip 8-bit C1 control sequences (0x9b CSI, 0x9d OSC, …) ([ecd702d](https://github.com/visulima/visulima/commit/ecd702ded915ae4affd2a0a65583d73819d9e8b3))
|
|
51
|
+
|
|
52
|
+
### Code Refactoring
|
|
53
|
+
|
|
54
|
+
* **ansi:** use replaceAll and reflow single-line arrow ([2f1525c](https://github.com/visulima/visulima/commit/2f1525c9176f0e7c65148fd2ac89b8cdb68a7b7e))
|
|
55
|
+
|
|
56
|
+
### Build System
|
|
57
|
+
|
|
58
|
+
* regenerate bundled-license manifests and types ordering ([af26588](https://github.com/visulima/visulima/commit/af26588d75aaa937fd4862800560bd4070a4878c))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Dependencies
|
|
62
|
+
|
|
63
|
+
* **@visulima/colorize:** upgraded to 2.0.0-alpha.14
|
|
64
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.13
|
|
65
|
+
|
|
1
66
|
## @visulima/ansi [4.0.0-alpha.16](https://github.com/visulima/visulima/compare/@visulima/ansi@4.0.0-alpha.15...@visulima/ansi@4.0.0-alpha.16) (2026-06-04)
|
|
2
67
|
|
|
3
68
|
### Bug Fixes
|
package/LICENSE.md
CHANGED
|
@@ -27,23 +27,6 @@ The published @visulima/ansi artifact additionally contains code with the follow
|
|
|
27
27
|
ISC, MIT
|
|
28
28
|
|
|
29
29
|
# Bundled dependencies:
|
|
30
|
-
## ansi-regex
|
|
31
|
-
License: MIT
|
|
32
|
-
By: Sindre Sorhus
|
|
33
|
-
Repository: chalk/ansi-regex
|
|
34
|
-
|
|
35
|
-
> MIT License
|
|
36
|
-
>
|
|
37
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
38
|
-
>
|
|
39
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
40
|
-
>
|
|
41
|
-
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
42
|
-
>
|
|
43
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
44
|
-
|
|
45
|
-
---------------------------------------
|
|
46
|
-
|
|
47
30
|
## mimic-function
|
|
48
31
|
License: MIT
|
|
49
32
|
By: Sindre Sorhus
|
package/README.md
CHANGED
|
@@ -82,10 +82,10 @@ import { cursorUp, cursorLeft } from "@visulima/ansi/cursor";
|
|
|
82
82
|
// etc, as above...
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
`@visulima/ansi` is ESM-only. In a CommonJS module, load it with a dynamic `import()`:
|
|
86
86
|
|
|
87
87
|
```js
|
|
88
|
-
const { cursorUp, cursorLeft } =
|
|
88
|
+
const { cursorUp, cursorLeft } = await import("@visulima/ansi");
|
|
89
89
|
|
|
90
90
|
// etc, as above...
|
|
91
91
|
```
|
|
@@ -110,10 +110,10 @@ process.stdout.write(eraseLine);
|
|
|
110
110
|
**Screen Clearing**
|
|
111
111
|
|
|
112
112
|
```javascript
|
|
113
|
-
import {
|
|
113
|
+
import { clearScreenAndHomeCursor, eraseDown } from "@visulima/ansi";
|
|
114
114
|
|
|
115
|
-
// Clear the entire screen
|
|
116
|
-
process.stdout.write(
|
|
115
|
+
// Clear the entire screen and move the cursor to the top-left
|
|
116
|
+
process.stdout.write(clearScreenAndHomeCursor);
|
|
117
117
|
|
|
118
118
|
// Clear from cursor to end of screen
|
|
119
119
|
process.stdout.write(eraseDown);
|
|
@@ -153,6 +153,17 @@ This package exports the following functions and constants. For a detailed list
|
|
|
153
153
|
- `clearScreenFromTopLeft`
|
|
154
154
|
- `resetTerminal`
|
|
155
155
|
|
|
156
|
+
**Clipboard** (from `clipboard.ts`)
|
|
157
|
+
|
|
158
|
+
- `setClipboard` — write text to the terminal clipboard via OSC 52 (works over SSH/tmux)
|
|
159
|
+
- `requestClipboard` — request the clipboard contents
|
|
160
|
+
- `clearClipboard` — clear a clipboard selection
|
|
161
|
+
- `ClipboardSelection` (type)
|
|
162
|
+
|
|
163
|
+
**Constants** (from `constants.ts`)
|
|
164
|
+
|
|
165
|
+
- `ESC`, `CSI`, `OSC`, `BEL`, `SEP`, `DCS`, `ST`, `APC`, `SOS`, `PM` — low-level sequence primitives for composing custom escape sequences
|
|
166
|
+
|
|
156
167
|
**Cursor** (from `cursor.ts`)
|
|
157
168
|
|
|
158
169
|
- `CURSOR_BACKWARD_1`
|
|
@@ -291,6 +302,14 @@ This package exports the following functions and constants. For a detailed list
|
|
|
291
302
|
- `screenPassthrough`
|
|
292
303
|
- `tmuxPassthrough`
|
|
293
304
|
|
|
305
|
+
**Progress** (from `progress.ts`)
|
|
306
|
+
|
|
307
|
+
- `resetProgressBar`
|
|
308
|
+
- `setProgressBar`
|
|
309
|
+
- `setErrorProgressBar`
|
|
310
|
+
- `setIndeterminateProgressBar`
|
|
311
|
+
- `setWarningProgressBar`
|
|
312
|
+
|
|
294
313
|
**Reset** (from `reset.ts`)
|
|
295
314
|
|
|
296
315
|
- `RESET_INITIAL_STATE`
|
|
@@ -404,11 +423,20 @@ This package exports the following functions and constants. For a detailed list
|
|
|
404
423
|
|
|
405
424
|
**XTerm** (from `xterm.ts`)
|
|
406
425
|
|
|
407
|
-
- `
|
|
408
|
-
- `
|
|
409
|
-
- `
|
|
410
|
-
- `
|
|
411
|
-
- `
|
|
426
|
+
- `keyModifierOptions` / `XTMODKEYS`
|
|
427
|
+
- `queryKeyModifierOptions` / `XTQMODKEYS`
|
|
428
|
+
- `setKeyModifierOptions`
|
|
429
|
+
- `resetKeyModifierOptions`
|
|
430
|
+
- `setModifyOtherKeys1`
|
|
431
|
+
- `setModifyOtherKeys2`
|
|
432
|
+
- `resetModifyOtherKeys`
|
|
433
|
+
- `queryModifyOtherKeys`
|
|
434
|
+
- `pushKittyKeyboard` — push Kitty keyboard protocol flags (`CSI > flags u`)
|
|
435
|
+
- `popKittyKeyboard` — pop flags off the stack (`CSI < n u`)
|
|
436
|
+
- `setKittyKeyboard` — set flags in place (`CSI = flags ; 1 u`)
|
|
437
|
+
- `queryKittyKeyboard` — query current flags (`CSI ? u`)
|
|
438
|
+
- `KittyKeyboardFlag` — bit-flag constants
|
|
439
|
+
- `KittyKeyboardFlags` (type)
|
|
412
440
|
|
|
413
441
|
## Related
|
|
414
442
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{CSI as e}from"./constants.js";const r=`${e}?1049h`,t=`${e}?1049l`,S=()=>r,a=()=>t;export{t as ALT_SCREEN_OFF,r as ALT_SCREEN_ON,a as alternativeScreenOff,S as alternativeScreenOn};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a sequence that sets the terminal's default foreground (text) color.
|
|
3
|
+
*
|
|
4
|
+
* The color may be any string the terminal understands for `OSC 10`, such as an
|
|
5
|
+
* X11 color name (`"red"`), a hex value (`"#ff0000"`), or an `XParseColor`
|
|
6
|
+
* string (`"rgb:ff/00/00"`, `"rgba:ff/00/00/ff"`).
|
|
7
|
+
*
|
|
8
|
+
* Sequence: `OSC 10 ; color BEL`
|
|
9
|
+
* @param color The color to set the foreground to.
|
|
10
|
+
* @returns The `OSC 10` escape sequence.
|
|
11
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands}
|
|
12
|
+
*/
|
|
13
|
+
declare const setForegroundColor: (color: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Sequence that queries the terminal's current default foreground color.
|
|
16
|
+
*
|
|
17
|
+
* Sequence: `OSC 10 ; ? BEL`
|
|
18
|
+
*/
|
|
19
|
+
declare const requestForegroundColor: string;
|
|
20
|
+
/**
|
|
21
|
+
* Sequence that resets the terminal's default foreground color to its default.
|
|
22
|
+
*
|
|
23
|
+
* Sequence: `OSC 110 BEL`
|
|
24
|
+
*/
|
|
25
|
+
declare const resetForegroundColor: string;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a sequence that sets the terminal's default background color.
|
|
28
|
+
*
|
|
29
|
+
* The color may be any string the terminal understands for `OSC 11` (X11 color
|
|
30
|
+
* name, hex value, or `XParseColor` string).
|
|
31
|
+
*
|
|
32
|
+
* Sequence: `OSC 11 ; color BEL`
|
|
33
|
+
* @param color The color to set the background to.
|
|
34
|
+
* @returns The `OSC 11` escape sequence.
|
|
35
|
+
*/
|
|
36
|
+
declare const setBackgroundColor: (color: string) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Sequence that queries the terminal's current default background color.
|
|
39
|
+
*
|
|
40
|
+
* Sequence: `OSC 11 ; ? BEL`
|
|
41
|
+
*/
|
|
42
|
+
declare const requestBackgroundColor: string;
|
|
43
|
+
/**
|
|
44
|
+
* Sequence that resets the terminal's default background color to its default.
|
|
45
|
+
*
|
|
46
|
+
* Sequence: `OSC 111 BEL`
|
|
47
|
+
*/
|
|
48
|
+
declare const resetBackgroundColor: string;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a sequence that sets the terminal's cursor color.
|
|
51
|
+
*
|
|
52
|
+
* The color may be any string the terminal understands for `OSC 12` (X11 color
|
|
53
|
+
* name, hex value, or `XParseColor` string).
|
|
54
|
+
*
|
|
55
|
+
* Sequence: `OSC 12 ; color BEL`
|
|
56
|
+
* @param color The color to set the cursor to.
|
|
57
|
+
* @returns The `OSC 12` escape sequence.
|
|
58
|
+
*/
|
|
59
|
+
declare const setCursorColor: (color: string) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Sequence that queries the terminal's current cursor color.
|
|
62
|
+
*
|
|
63
|
+
* Sequence: `OSC 12 ; ? BEL`
|
|
64
|
+
*/
|
|
65
|
+
declare const requestCursorColor: string;
|
|
66
|
+
/**
|
|
67
|
+
* Sequence that resets the terminal's cursor color to its default.
|
|
68
|
+
*
|
|
69
|
+
* Sequence: `OSC 112 BEL`
|
|
70
|
+
*/
|
|
71
|
+
declare const resetCursorColor: string;
|
|
72
|
+
export { requestBackgroundColor, requestCursorColor, requestForegroundColor, resetBackgroundColor, resetCursorColor, resetForegroundColor, setBackgroundColor, setCursorColor, setForegroundColor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{OSC as r,BEL as o,stripOscTerminators as e}from"./constants.js";const t=$=>`${r}10;${e($)}${o}`,C=`${r}10;?${o}`,u=`${r}110${o}`,l=$=>`${r}11;${e($)}${o}`,n=`${r}11;?${o}`,d=`${r}111${o}`,g=$=>`${r}12;${e($)}${o}`,c=`${r}12;?${o}`,a=`${r}112${o}`;export{n as requestBackgroundColor,c as requestCursorColor,C as requestForegroundColor,d as resetBackgroundColor,a as resetCursorColor,u as resetForegroundColor,l as setBackgroundColor,g as setCursorColor,t as setForegroundColor};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a Select Character Set (SCS) sequence that designates `charset` into
|
|
3
|
+
* one of the G0–G3 character-set slots.
|
|
4
|
+
*
|
|
5
|
+
* `gset` is one of the designator characters (see {@link G0}, {@link G1},
|
|
6
|
+
* {@link G2}, {@link G3} for 94-character sets, or `"-"`, `"."`, `"/"` for the
|
|
7
|
+
* 96-character G1–G3 slots). `charset` selects the final character of the set,
|
|
8
|
+
* e.g. {@link USASCII} (`"B"`), {@link DEC_SPECIAL_GRAPHICS} (`"0"`) or
|
|
9
|
+
* {@link UNITED_KINGDOM} (`"A"`).
|
|
10
|
+
*
|
|
11
|
+
* Sequence: `ESC gset charset`
|
|
12
|
+
* @param gset The G-set designator character.
|
|
13
|
+
* @param charset The final character identifying the character set.
|
|
14
|
+
* @returns The SCS escape sequence.
|
|
15
|
+
* @see {@link https://vt100.net/docs/vt510-rm/SCS.html}
|
|
16
|
+
*/
|
|
17
|
+
declare const selectCharacterSet: (gset: string, charset: string) => string;
|
|
18
|
+
/** Alias for {@link selectCharacterSet} (Select Character Set). */
|
|
19
|
+
declare const SCS: typeof selectCharacterSet;
|
|
20
|
+
/** G0 designator for a 94-character set. */
|
|
21
|
+
declare const G0: string;
|
|
22
|
+
/** G1 designator for a 94-character set. */
|
|
23
|
+
declare const G1: string;
|
|
24
|
+
/** G2 designator for a 94-character set. */
|
|
25
|
+
declare const G2: string;
|
|
26
|
+
/** G3 designator for a 94-character set. */
|
|
27
|
+
declare const G3: string;
|
|
28
|
+
/** DEC Special Character and Line Drawing Set (final character `0`). */
|
|
29
|
+
declare const DEC_SPECIAL_GRAPHICS: string;
|
|
30
|
+
/** United Kingdom character set (final character `A`). */
|
|
31
|
+
declare const UNITED_KINGDOM: string;
|
|
32
|
+
/** United States (USASCII) character set (final character `B`). */
|
|
33
|
+
declare const USASCII: string;
|
|
34
|
+
/** Locking Shift 0 (LS0 / SI): invoke G0 into GL. Sequence: `SI` (`\u000F`). */
|
|
35
|
+
declare const LS0: string;
|
|
36
|
+
/** Alias for {@link LS0} (Shift In). */
|
|
37
|
+
declare const SI: string;
|
|
38
|
+
/** Locking Shift 1 (LS1 / SO): invoke G1 into GL. Sequence: `SO` (`\u000E`). */
|
|
39
|
+
declare const LS1: string;
|
|
40
|
+
/** Alias for {@link LS1} (Shift Out). */
|
|
41
|
+
declare const SO: string;
|
|
42
|
+
/** Locking Shift 1 Right (LS1R): invoke G1 into GR. Sequence: `ESC ~`. */
|
|
43
|
+
declare const LS1R: string;
|
|
44
|
+
/** Locking Shift 2 (LS2): invoke G2 into GL. Sequence: `ESC n`. */
|
|
45
|
+
declare const LS2: string;
|
|
46
|
+
/** Locking Shift 2 Right (LS2R): invoke G2 into GR. Sequence: `ESC }`. */
|
|
47
|
+
declare const LS2R: string;
|
|
48
|
+
/** Locking Shift 3 (LS3): invoke G3 into GL. Sequence: `ESC o`. */
|
|
49
|
+
declare const LS3: string;
|
|
50
|
+
/** Locking Shift 3 Right (LS3R): invoke G3 into GR. Sequence: `ESC |`. */
|
|
51
|
+
declare const LS3R: string;
|
|
52
|
+
export { DEC_SPECIAL_GRAPHICS, G0, G1, G2, G3, LS0, LS1, LS1R, LS2, LS2R, LS3, LS3R, SCS, SI, SO, UNITED_KINGDOM, USASCII, selectCharacterSet };
|
package/dist/charset.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ESC as S}from"./constants.js";const C=(L,$)=>`${S}${L}${$}`,e=C,o="(",r=")",A="*",E="+",R="0",c="A",D="B",I="",_=I,t="",a=t,m=`${S}~`,n=`${S}n`,p=`${S}}`,s=`${S}o`,N=`${S}|`;export{R as DEC_SPECIAL_GRAPHICS,o as G0,r as G1,A as G2,E as G3,I as LS0,t as LS1,m as LS1R,n as LS2,p as LS2R,s as LS3,N as LS3R,e as SCS,_ as SI,a as SO,c as UNITED_KINGDOM,D as USASCII,C as selectCharacterSet};
|
package/dist/clear.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{CSI as n,ESC as o}from"./constants.js";import{u as i,A as s}from"./packem_shared/cursor-BXG1O_IE.js";import{eraseInLine as c,eraseDisplay as e,EraseDisplayMode as r,EraseLineMode as a}from"./erase.js";const E=i(0,0)+e(r.ToEnd),S=`${c(a.EntireLine)}${n}G`,l=`${n}H${e(r.EntireScreen)}`,d=s?`${e(r.EntireScreen)}${n}0f`:`${e(r.EntireScreen)}${e(r.EntireScreenAndScrollback)}${n}H${o}c`;export{S as clearLineAndHomeCursor,l as clearScreenAndHomeCursor,E as clearScreenFromTopLeft,d as resetTerminal};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection targets for OSC 52 clipboard operations.
|
|
3
|
+
*
|
|
4
|
+
* - `c` is the system clipboard (the common default).
|
|
5
|
+
* - `p` is the primary selection (X11 middle-click paste buffer).
|
|
6
|
+
* - `q` is the secondary selection.
|
|
7
|
+
* - `s` is the "select" selection.
|
|
8
|
+
* - `0` to `7` are numbered cut buffers.
|
|
9
|
+
*
|
|
10
|
+
* Multiple targets may be combined (e.g. `"cp"`) to write the same data to
|
|
11
|
+
* several selections at once.
|
|
12
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html}
|
|
13
|
+
*/
|
|
14
|
+
type ClipboardSelection = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "c" | "p" | "q" | "s" | (string & {});
|
|
15
|
+
/**
|
|
16
|
+
* Writes data to the terminal's clipboard using the OSC 52 escape sequence.
|
|
17
|
+
*
|
|
18
|
+
* Sequence: `OSC 52 ; selection ; base64-data ST`
|
|
19
|
+
*
|
|
20
|
+
* OSC 52 is the only clipboard mechanism that works over SSH/tmux, because the
|
|
21
|
+
* write travels in-band over the terminal stream rather than touching a local
|
|
22
|
+
* clipboard API. The terminal emulator must have clipboard writes enabled
|
|
23
|
+
* (e.g. `set-clipboard` in xterm, `allow-passthrough` plus `set-clipboard` in
|
|
24
|
+
* tmux); many enable it by default.
|
|
25
|
+
* @param data The text to place on the clipboard.
|
|
26
|
+
* @param selection The selection target(s). Defaults to `"c"` (system clipboard).
|
|
27
|
+
* @param terminator The OSC terminator to use. Defaults to {@link BEL}; pass
|
|
28
|
+
* {@link ST} (`ESC backslash`) for terminals that require the canonical String Terminator.
|
|
29
|
+
* @returns The OSC 52 escape sequence.
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { setClipboard } from "@visulima/ansi/clipboard";
|
|
33
|
+
*
|
|
34
|
+
* // Copy a generated token to the user's local clipboard from a remote shell.
|
|
35
|
+
* process.stdout.write(setClipboard("my-secret-token"));
|
|
36
|
+
* ```
|
|
37
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html}
|
|
38
|
+
*/
|
|
39
|
+
declare const setClipboard: (data: string, selection?: ClipboardSelection, terminator?: string) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Requests the current contents of the terminal's clipboard via OSC 52.
|
|
42
|
+
*
|
|
43
|
+
* Sequence: `OSC 52 ; selection ; ? ST`
|
|
44
|
+
*
|
|
45
|
+
* The terminal responds with `OSC 52 ; selection ; base64-data ST` if it
|
|
46
|
+
* permits clipboard reads (frequently disabled for security). Decode the
|
|
47
|
+
* Base64 payload from the response to obtain the clipboard text.
|
|
48
|
+
* @param selection The selection target to query. Defaults to `"c"` (system clipboard).
|
|
49
|
+
* @param terminator The OSC terminator to use. Defaults to {@link BEL}; pass {@link ST} for terminals that require it.
|
|
50
|
+
* @returns The OSC 52 query escape sequence.
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import { requestClipboard } from "@visulima/ansi/clipboard";
|
|
54
|
+
*
|
|
55
|
+
* process.stdout.write(requestClipboard());
|
|
56
|
+
* ```
|
|
57
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html}
|
|
58
|
+
*/
|
|
59
|
+
declare const requestClipboard: (selection?: ClipboardSelection, terminator?: string) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Clears the terminal's clipboard for the given selection via OSC 52.
|
|
62
|
+
*
|
|
63
|
+
* Sequence: `OSC 52 ; selection ; ST` (an empty payload clears the selection).
|
|
64
|
+
* @param selection The selection target to clear. Defaults to `"c"` (system clipboard).
|
|
65
|
+
* @param terminator The OSC terminator to use. Defaults to {@link BEL}; pass {@link ST} for terminals that require it.
|
|
66
|
+
* @returns The OSC 52 clear escape sequence.
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* import { clearClipboard } from "@visulima/ansi/clipboard";
|
|
70
|
+
*
|
|
71
|
+
* process.stdout.write(clearClipboard());
|
|
72
|
+
* ```
|
|
73
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html}
|
|
74
|
+
*/
|
|
75
|
+
declare const clearClipboard: (selection?: ClipboardSelection, terminator?: string) => string;
|
|
76
|
+
export { ClipboardSelection, clearClipboard, requestClipboard, setClipboard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{OSC as e,BEL as n}from"./constants.js";const f=r=>{const o=new TextEncoder().encode(r),t=o.toBase64;if(typeof t=="function")return t.call(o);if(typeof btoa=="function"){let i="";for(const c of o)i+=String.fromCodePoint(c);return btoa(i)}const a=globalThis.Buffer;if(a===void 0)throw new Error("No Base64 encoder available: Uint8Array.prototype.toBase64, btoa and Buffer are all missing.");return a.from(o).toString("base64")},l=(r,o="c",t=n)=>`${e}52;${o};${f(r)}${t}`,$=(r="c",o=n)=>`${e}52;${r};?${o}`,b=(r="c",o=n)=>`${e}52;${r};${o}`;export{b as clearClipboard,$ as requestClipboard,l as setClipboard};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Escape character (\u001B). */
|
|
2
|
+
declare const ESC: string;
|
|
3
|
+
/** Control Sequence Introducer (ESC [). */
|
|
4
|
+
declare const CSI: string;
|
|
5
|
+
/** Operating System Command (ESC ]). */
|
|
6
|
+
declare const OSC: string;
|
|
7
|
+
/** Bell character (\u0007). Often used to terminate OSC sequences. */
|
|
8
|
+
declare const BEL: string;
|
|
9
|
+
/** Separator used in some ANSI sequences, typically a semicolon. */
|
|
10
|
+
declare const SEP: string;
|
|
11
|
+
/** Device Control String (ESC P). */
|
|
12
|
+
declare const DCS: string;
|
|
13
|
+
/** String Terminator (ESC \\). Used to terminate DCS, SOS, PM, APC sequences. */
|
|
14
|
+
declare const ST: string;
|
|
15
|
+
/** Application Program Command (ESC _). */
|
|
16
|
+
declare const APC: string;
|
|
17
|
+
/** Start of String (ESC X). */
|
|
18
|
+
declare const SOS: string;
|
|
19
|
+
/** Privacy Message (ESC ^). */
|
|
20
|
+
declare const PM: string;
|
|
21
|
+
/**
|
|
22
|
+
* Strips OSC terminators (BEL, ESC) from a caller-supplied value so it cannot
|
|
23
|
+
* inject or prematurely terminate an escape sequence when interpolated into one.
|
|
24
|
+
* @param value The untrusted string to sanitize.
|
|
25
|
+
* @returns `value` with all BEL and ESC characters removed.
|
|
26
|
+
*/
|
|
27
|
+
declare const stripOscTerminators: (value: string) => string;
|
|
28
|
+
export { APC, BEL, CSI, DCS, ESC, OSC, PM, SEP, SOS, ST, stripOscTerminators };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const B="\x1B",S="\x1B[",r="\x1B]",C="\x07",e=";",s="\x1BP",t="\x1B\\",P="\x1B_",c="\x1BX",l="\x1B^",o=x=>x.replaceAll(/[\u0007\u001B]/g,"");export{P as APC,C as BEL,S as CSI,s as DCS,B as ESC,r as OSC,l as PM,e as SEP,c as SOS,t as ST,o as stripOscTerminators};
|
package/dist/cursor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./
|
|
1
|
+
import"./constants.js";import{C as o,a as u,b as e,c as R,B as c,R as t,d as S,e as C,S as _,f as O,g as E,h as U,i,j as l,k as T,l as n,m as D,n as d,o as w,p as A,q as b,r as f,s as m,t as p,u as N,v as P,w as v,x,y as B,z as I}from"./packem_shared/cursor-BXG1O_IE.js";import{default as k}from"./packem_shared/restoreCursor-CyaXIMQf.js";export{o as CURSOR_BACKWARD_1,u as CURSOR_DOWN_1,e as CURSOR_FORWARD_1,R as CURSOR_UP_1,c as CursorStyle,t as REQUEST_CURSOR_POSITION,S as REQUEST_EXTENDED_CURSOR_POSITION,C as RESTORE_CURSOR_DEC,_ as SAVE_CURSOR_DEC,O as cursorBackward,E as cursorBackwardTab,U as cursorDown,i as cursorForward,l as cursorHide,T as cursorHorizontalAbsolute,n as cursorHorizontalForwardTab,D as cursorLeft,d as cursorMove,w as cursorNextLine,A as cursorPosition,b as cursorPreviousLine,f as cursorRestore,m as cursorSave,p as cursorShow,N as cursorTo,P as cursorToColumn1,v as cursorUp,x as cursorVerticalAbsolute,B as eraseCharacter,k as restoreCursor,I as setCursorStyle};
|
package/dist/cwd.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a sequence that reports the current working directory to the terminal.
|
|
3
|
+
*
|
|
4
|
+
* Terminals such as iTerm2, WezTerm and others use this `OSC 7` sequence to keep
|
|
5
|
+
* track of the shell's working directory — for example to open new tabs/splits in
|
|
6
|
+
* the same directory. The payload is a `file://` URL built from the optional
|
|
7
|
+
* `host` and the joined `paths`.
|
|
8
|
+
*
|
|
9
|
+
* Sequence: `OSC 7 ; file://[host]/[path] BEL`
|
|
10
|
+
* @param host The host portion of the `file://` URL (use an empty string for the local machine).
|
|
11
|
+
* @param paths One or more path segments that are joined into the URL path.
|
|
12
|
+
* @returns The `OSC 7` escape sequence.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { notifyWorkingDirectory } from "@visulima/ansi/cwd";
|
|
16
|
+
*
|
|
17
|
+
* process.stdout.write(notifyWorkingDirectory("", process.cwd()));
|
|
18
|
+
* ```
|
|
19
|
+
* @see {@link https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/20}
|
|
20
|
+
*/
|
|
21
|
+
declare const notifyWorkingDirectory: (host: string, ...paths: string[]) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for {@link notifyWorkingDirectory}.
|
|
24
|
+
*/
|
|
25
|
+
declare const setWorkingDirectory: (host: string, ...paths: string[]) => string;
|
|
26
|
+
export { notifyWorkingDirectory, setWorkingDirectory };
|
package/dist/cwd.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{stripOscTerminators as s,OSC as c,BEL as l}from"./constants.js";const $=(t,...o)=>{const r=o.filter(n=>n.length>0).join("/").replaceAll(/\/{2,}/g,"/"),e=r.startsWith("/")?r:`/${r}`,i=s(t);return`${c}7;file://${i}${encodeURI(e)}${l}`},g=$;export{$ as notifyWorkingDirectory,g as setWorkingDirectory};
|
package/dist/erase.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{CSI as s}from"./constants.js";import{v as a,w as c}from"./packem_shared/cursor-BXG1O_IE.js";var t=(e=>(e[e.ToEnd=0]="ToEnd",e[e.ToBeginning=1]="ToBeginning",e[e.EntireScreen=2]="EntireScreen",e[e.EntireScreenAndScrollback=3]="EntireScreenAndScrollback",e))(t||{});const r=e=>{const n=e>=0&&e<=3?e:0;return`${s}${n===0?"":String(n)}J`};var E=(e=>(e[e.ToEnd=0]="ToEnd",e[e.ToBeginning=1]="ToBeginning",e[e.EntireLine=2]="EntireLine",e))(E||{});const o=e=>{const n=e>=0&&e<=2?e:0;return`${s}${n===0?"":String(n)}K`},g=r(0),S=o(2),T=o(0),L=o(1),p=e=>{if(e<=0)return"";let n="";for(let i=0;i<e;i+=1)n+=S,i<e-1&&(n+=c());return n+=a,n},u=r(2),m=r(1),f=r(3);export{t as EraseDisplayMode,E as EraseLineMode,r as eraseDisplay,g as eraseDown,o as eraseInLine,S as eraseLine,T as eraseLineEnd,L as eraseLineStart,p as eraseLines,u as eraseScreen,f as eraseScreenAndScrollback,m as eraseUp};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a FinalTerm shell-integration sequence (`OSC 133`).
|
|
3
|
+
*
|
|
4
|
+
* The FinalTerm protocol lets shells mark the structure of their output — where
|
|
5
|
+
* the prompt starts, where the user's command begins, where its output starts
|
|
6
|
+
* and when it finished — so terminals can offer features like jump-to-prompt,
|
|
7
|
+
* command status and selection of command output.
|
|
8
|
+
*
|
|
9
|
+
* Sequence: `OSC 133 ; Pt BEL`
|
|
10
|
+
* @param pm The semicolon-delimited parameters of the sequence.
|
|
11
|
+
* @returns The `OSC 133` escape sequence.
|
|
12
|
+
* @see {@link https://iterm2.com/documentation-shell-integration.html}
|
|
13
|
+
*/
|
|
14
|
+
declare const finalTerm: (...pm: string[]) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Marks the start of the shell prompt. Sent just before the prompt is printed.
|
|
17
|
+
*
|
|
18
|
+
* Sequence: `OSC 133 ; A ; Pt BEL`
|
|
19
|
+
* @param pm Additional parameters appended after the `A` marker.
|
|
20
|
+
* @returns The `OSC 133 ; A` escape sequence.
|
|
21
|
+
*/
|
|
22
|
+
declare const finalTermPrompt: (...pm: string[]) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Marks the end of the prompt and the start of the user's command input.
|
|
25
|
+
*
|
|
26
|
+
* Sequence: `OSC 133 ; B ; Pt BEL`
|
|
27
|
+
* @param pm Additional parameters appended after the `B` marker.
|
|
28
|
+
* @returns The `OSC 133 ; B` escape sequence.
|
|
29
|
+
*/
|
|
30
|
+
declare const finalTermCmdStart: (...pm: string[]) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Marks the start of the command output (the command is about to be executed).
|
|
33
|
+
*
|
|
34
|
+
* Sequence: `OSC 133 ; C ; Pt BEL`
|
|
35
|
+
* @param pm Additional parameters appended after the `C` marker.
|
|
36
|
+
* @returns The `OSC 133 ; C` escape sequence.
|
|
37
|
+
*/
|
|
38
|
+
declare const finalTermCmdExecuted: (...pm: string[]) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Marks the end of the command output. May carry the command's exit code.
|
|
41
|
+
*
|
|
42
|
+
* Sequence: `OSC 133 ; D ; Pt BEL`
|
|
43
|
+
* @param pm Additional parameters appended after the `D` marker (e.g. the exit code).
|
|
44
|
+
* @returns The `OSC 133 ; D` escape sequence.
|
|
45
|
+
*/
|
|
46
|
+
declare const finalTermCmdFinished: (...pm: string[]) => string;
|
|
47
|
+
export { finalTerm, finalTermCmdExecuted, finalTermCmdFinished, finalTermCmdStart, finalTermPrompt };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{OSC as e,BEL as n,stripOscTerminators as t}from"./constants.js";const r=(...m)=>`${e}133;${m.map(i=>t(i)).join(";")}${n}`,o=(...m)=>r("A",...m),f=(...m)=>r("B",...m),T=(...m)=>r("C",...m),d=(...m)=>r("D",...m);export{r as finalTerm,T as finalTermCmdExecuted,d as finalTermCmdFinished,f as finalTermCmdStart,o as finalTermPrompt};
|
package/dist/focus.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event a terminal emits when the window gains focus, while focus event
|
|
3
|
+
* reporting is enabled (DEC private mode 1004).
|
|
4
|
+
*
|
|
5
|
+
* Sequence: `CSI I`
|
|
6
|
+
* @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Focus-Tracking}
|
|
7
|
+
*/
|
|
8
|
+
declare const FOCUS: string;
|
|
9
|
+
/**
|
|
10
|
+
* Event a terminal emits when the window loses focus, while focus event
|
|
11
|
+
* reporting is enabled (DEC private mode 1004).
|
|
12
|
+
*
|
|
13
|
+
* Sequence: `CSI O`
|
|
14
|
+
*/
|
|
15
|
+
declare const BLUR: string;
|
|
16
|
+
/** Alias for {@link FOCUS}. */
|
|
17
|
+
declare const focusInEvent: string;
|
|
18
|
+
/** Alias for {@link BLUR}. */
|
|
19
|
+
declare const focusOutEvent: string;
|
|
20
|
+
export { BLUR, FOCUS, focusInEvent, focusOutEvent };
|
package/dist/focus.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CSI as o}from"./constants.js";const t=`${o}I`,n=`${o}O`,e=t,f=n;export{n as BLUR,t as FOCUS,e as focusInEvent,f as focusOutEvent};
|
package/dist/hyperlink.d.ts
CHANGED
|
@@ -1,2 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a clickable hyperlink in the terminal.
|
|
3
|
+
*
|
|
4
|
+
* This function constructs an ANSI escape sequence that, when printed to a compatible terminal,
|
|
5
|
+
* renders as a clickable link. The link's visible text and its target URL are specified
|
|
6
|
+
* by the `text` and `url` parameters, respectively.
|
|
7
|
+
*
|
|
8
|
+
* For information on terminal support for hyperlinks, see this
|
|
9
|
+
* [Gist by Egmont Kob](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda).
|
|
10
|
+
* To programmatically check for hyperlink support in the current environment,
|
|
11
|
+
* consider using a library like [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks).
|
|
12
|
+
* @param text The visible text of the link.
|
|
13
|
+
* @param url The URL the link should point to.
|
|
14
|
+
* @returns A string representing the ANSI escape sequence for the hyperlink.
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { hyperlink } from "@visulima/ansi/hyperlink"; // Adjust import path as needed
|
|
18
|
+
*
|
|
19
|
+
* const aLink = hyperlink("Visulima", "https://www.visulima.com");
|
|
20
|
+
* console.log(`Visit ${aLink} for more information.`);
|
|
21
|
+
* // In a supported terminal, this will output:
|
|
22
|
+
* // Visit Visulima for more information. (where "Visulima" is a clickable link)
|
|
23
|
+
* ```
|
|
24
|
+
* @see {@link https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda} for supported terminals.
|
|
25
|
+
*/
|
|
1
26
|
declare const hyperlink: (text: string, url: string) => string;
|
|
2
27
|
export { hyperlink as default };
|
package/dist/hyperlink.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{stripOscTerminators as r,OSC as t,SEP as o,BEL as s}from"./constants.js";const m=(n,a)=>{const c=r(a),e=r(n);return[t,"8",o,o,c,s,e,t,"8",o,o,s].join("")};export{m as default};
|
package/dist/image.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ interface ImageOptions {
|
|
|
37
37
|
* @param options Optional parameters to control how the image is displayed (e.g., width, height, aspect ratio).
|
|
38
38
|
* See {@link ImageOptions}.
|
|
39
39
|
* @returns A string containing the ANSI escape sequence for displaying the image in iTerm2.
|
|
40
|
-
* Returns an empty string if `data` is null or undefined, though TypeScript should prevent this.
|
|
41
40
|
* @example
|
|
42
41
|
* ```typescript
|
|
43
42
|
* import { image } from '@visulima/ansi/image'; // Adjust import path
|
|
@@ -61,9 +60,9 @@ interface ImageOptions {
|
|
|
61
60
|
* ```
|
|
62
61
|
* @remarks
|
|
63
62
|
* - This sequence is specific to iTerm2 and may not work in other terminal emulators.
|
|
64
|
-
* -
|
|
65
|
-
*
|
|
66
|
-
*
|
|
63
|
+
* - Base64 encoding is runtime-agnostic: it prefers the standardized
|
|
64
|
+
* `Uint8Array.prototype.toBase64` (Node ≥ 24, modern browsers), then `btoa`,
|
|
65
|
+
* then Node's `Buffer`, so the helper works in browser/xterm.js bundles too.
|
|
67
66
|
* - The `name` parameter (for filename) is not directly supported by this simplified helper but is part of the
|
|
68
67
|
* full iTerm2 inline image protocol. For more advanced features, consider using the more detailed iTerm2 sequence
|
|
69
68
|
* builders in `iterm2/` files.
|
package/dist/image.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{OSC as n,BEL as a}from"./constants.js";const s=e=>{const t=e.toBase64;if(typeof t=="function")return t.call(e);if(typeof btoa=="function"){let i="";for(const r of e)i+=String.fromCodePoint(r);return btoa(i)}const o=globalThis.Buffer;if(o===void 0)throw new Error("No Base64 encoder available: Uint8Array.prototype.toBase64, btoa and Buffer are all missing.");return o.from(e).toString("base64")},l=(e,t={})=>{let o=`${n}1337;File=inline=1`;t.width!==void 0&&(o+=`;width=${String(t.width)}`),t.height!==void 0&&(o+=`;height=${String(t.height)}`),t.preserveAspectRatio===!1&&(o+=";preserveAspectRatio=0");const i=s(e);return`${o}:${i}${a}`};export{l as image};
|