@visulima/ansi 3.0.5 → 4.0.0-alpha.2
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 +36 -0
- package/README.md +32 -14
- package/package.json +51 -3
- package/dist/alternative-screen.d.ts +0 -74
- package/dist/alternative-screen.js +0 -1
- package/dist/clear.d.ts +0 -77
- package/dist/clear.js +0 -1
- package/dist/constants.d.ts +0 -20
- package/dist/cursor.d.ts +0 -437
- package/dist/cursor.js +0 -1
- package/dist/erase.d.ts +0 -206
- package/dist/erase.js +0 -1
- package/dist/helpers.d.ts +0 -14
- package/dist/hyperlink.d.ts +0 -27
- package/dist/hyperlink.js +0 -1
- package/dist/image.d.ts +0 -73
- package/dist/image.js +0 -1
- package/dist/index.d.ts +0 -36
- package/dist/index.js +0 -1
- package/dist/iterm2/iterm2-properties.d.ts +0 -135
- package/dist/iterm2/iterm2-sequences.d.ts +0 -96
- package/dist/iterm2.d.ts +0 -58
- package/dist/iterm2.js +0 -1
- package/dist/mode.d.ts +0 -726
- package/dist/mode.js +0 -1
- package/dist/mouse.d.ts +0 -230
- package/dist/mouse.js +0 -1
- package/dist/packem_shared/IT2_AUTO-BYrffRAq.js +0 -1
- package/dist/packem_shared/ITerm2File-C88DBJC-.js +0 -1
- package/dist/packem_shared/constants-D12jy2Zh.js +0 -1
- package/dist/packem_shared/cursor-nxpKt8Tn.js +0 -1
- package/dist/packem_shared/resetProgressBar-BtBbpWCM.js +0 -1
- package/dist/packem_shared/restoreCursor-CHy0jZuu.js +0 -2
- package/dist/passthrough.d.ts +0 -77
- package/dist/passthrough.js +0 -1
- package/dist/progress.d.ts +0 -41
- package/dist/reset.d.ts +0 -26
- package/dist/reset.js +0 -1
- package/dist/screen.d.ts +0 -234
- package/dist/screen.js +0 -1
- package/dist/scroll.d.ts +0 -67
- package/dist/scroll.js +0 -1
- package/dist/status.d.ts +0 -524
- package/dist/status.js +0 -1
- package/dist/strip.d.ts +0 -23
- package/dist/strip.js +0 -1
- package/dist/termcap.d.ts +0 -38
- package/dist/termcap.js +0 -1
- package/dist/title.d.ts +0 -185
- package/dist/title.js +0 -1
- package/dist/window-ops.d.ts +0 -418
- package/dist/window-ops.js +0 -1
- package/dist/xterm.d.ts +0 -94
- package/dist/xterm.js +0 -1
package/dist/hyperlink.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
*/
|
|
26
|
-
declare const hyperlink: (text: string, url: string) => string;
|
|
27
|
-
export default hyperlink;
|
package/dist/hyperlink.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var n=(e,a)=>i(e,"name",{value:a,configurable:!0});import{O as o,S as r,B as t}from"./packem_shared/constants-D12jy2Zh.js";var s=Object.defineProperty,f=n((e,a)=>s(e,"name",{value:a,configurable:!0}),"n");const u=f((e,a)=>[o,"8",r,r,a,t,e,o,"8",r,r,t].join(""),"hyperlink");export{u as default};
|
package/dist/image.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { LiteralUnion } from "type-fest";
|
|
2
|
-
/**
|
|
3
|
-
* Options for controlling the display of an inline image in iTerm2.
|
|
4
|
-
*/
|
|
5
|
-
export interface ImageOptions {
|
|
6
|
-
/**
|
|
7
|
-
* The display height of the image. It can be specified as:
|
|
8
|
-
* - A number: Interpreted as the number of character cells (e.g., `10`).
|
|
9
|
-
* - A string with `px`: Interpreted as pixels (e.g., `"100px"`).
|
|
10
|
-
* - A string with `%`: Interpreted as a percentage of the terminal session's height (e.g., `"50%"`).
|
|
11
|
-
* - The string `"auto"`: The image's inherent height will be used, or the terminal will decide.
|
|
12
|
-
*/
|
|
13
|
-
readonly height?: LiteralUnion<"auto", number | string>;
|
|
14
|
-
/**
|
|
15
|
-
* Controls whether the image's aspect ratio is preserved when scaling.
|
|
16
|
-
* - If `true` (default), the aspect ratio is preserved.
|
|
17
|
-
* - If `false`, the image may be stretched to fit the specified width and height.
|
|
18
|
-
* Corresponds to the `preserveAspectRatio` argument in the iTerm2 sequence (`1` for true, `0` for false).
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
readonly preserveAspectRatio?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* The display width of the image. It can be specified as:
|
|
24
|
-
* - A number: Interpreted as the number of character cells (e.g., `20`).
|
|
25
|
-
* - A string with `px`: Interpreted as pixels (e.g., `"200px"`).
|
|
26
|
-
* - A string with `%`: Interpreted as a percentage of the terminal session's width (e.g., `"75%"`).
|
|
27
|
-
* - The string `"auto"`: The image's inherent width will be used, or the terminal will decide.
|
|
28
|
-
*/
|
|
29
|
-
readonly width?: LiteralUnion<"auto", number | string>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Generates an ANSI escape sequence for displaying an image inline, primarily for iTerm2.
|
|
33
|
-
*
|
|
34
|
-
* This function constructs a proprietary iTerm2 escape sequence (`OSC 1337 ; File = [arguments] : <base64_data> BEL`)
|
|
35
|
-
* that allows raw image data to be displayed directly in the terminal.
|
|
36
|
-
* @param data The raw image data as a `Uint8Array`. This data will be Base64 encoded.
|
|
37
|
-
* @param options Optional parameters to control how the image is displayed (e.g., width, height, aspect ratio).
|
|
38
|
-
* See {@link ImageOptions}.
|
|
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
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* import { image } from '@visulima/ansi/image'; // Adjust import path
|
|
44
|
-
* import { promises as fs } from 'fs';
|
|
45
|
-
*
|
|
46
|
-
* async function displayImage() {
|
|
47
|
-
* try {
|
|
48
|
-
* const imageData = await fs.readFile('path/to/your/image.png');
|
|
49
|
-
* const imageSequence = image(new Uint8Array(imageData), {
|
|
50
|
-
* width: 50, // 50 character cells wide
|
|
51
|
-
* height: "auto",
|
|
52
|
-
* preserveAspectRatio: true,
|
|
53
|
-
* });
|
|
54
|
-
* console.log(imageSequence);
|
|
55
|
-
* } catch (error) {
|
|
56
|
-
* console.error("Error reading or displaying image:", error);
|
|
57
|
-
* }
|
|
58
|
-
* }
|
|
59
|
-
*
|
|
60
|
-
* displayImage();
|
|
61
|
-
* ```
|
|
62
|
-
* @remarks
|
|
63
|
-
* - This sequence is specific to iTerm2 and may not work in other terminal emulators.
|
|
64
|
-
* - For Node.js environments, `Buffer.from(data).toString("base64")` is used for Base64 encoding.
|
|
65
|
-
* In browser environments, a polyfill or an alternative method for Base64 encoding `Uint8Array` would be necessary
|
|
66
|
-
* if `Buffer` is not available (e.g., `btoa(String.fromCharCode(...data))` after careful handling of binary data).
|
|
67
|
-
* - The `name` parameter (for filename) is not directly supported by this simplified helper but is part of the
|
|
68
|
-
* full iTerm2 inline image protocol. For more advanced features, consider using the more detailed iTerm2 sequence
|
|
69
|
-
* builders in `iterm2/` files.
|
|
70
|
-
* @see {@link https://iterm2.com/documentation-images.html} iTerm2 Inline Images Protocol.
|
|
71
|
-
* @see {@link ImageOptions}
|
|
72
|
-
*/
|
|
73
|
-
export declare const image: (data: Uint8Array, options?: ImageOptions) => string;
|
package/dist/image.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=Object.defineProperty;var o=(r,e)=>n(r,"name",{value:e,configurable:!0});import{createRequire as a}from"node:module";import{O as l,B as p}from"./packem_shared/constants-D12jy2Zh.js";const c=a(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=o(r=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,i]=t.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return t.getBuiltinModule(r)}return c(r)},"__cjs_getBuiltinModule"),{Buffer:f}=u("node:buffer");var d=Object.defineProperty,g=o((r,e)=>d(r,"name",{value:e,configurable:!0}),"i");const v=g((r,e={})=>{if(!r)return"";let i=`${l}1337;File=inline=1`;e.width!==void 0&&(i+=`;width=${e.width}`),e.height!==void 0&&(i+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(i+=";preserveAspectRatio=0");const s=f.from(r).toString("base64");return`${i}:${s}${p}`},"image");export{v as image};
|
package/dist/index.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Output a beeping sound.
|
|
3
|
-
*/
|
|
4
|
-
export declare const beep = "\u0007";
|
|
5
|
-
export { ALT_SCREEN_OFF, ALT_SCREEN_ON, alternativeScreenOff, alternativeScreenOn } from "./alternative-screen.d.ts";
|
|
6
|
-
export { clearLineAndHomeCursor, clearScreenAndHomeCursor, clearScreenFromTopLeft, resetTerminal } from "./clear.d.ts";
|
|
7
|
-
export type { CursorStyle } from "./cursor.d.ts";
|
|
8
|
-
export { CURSOR_BACKWARD_1, CURSOR_DOWN_1, CURSOR_FORWARD_1, CURSOR_UP_1, cursorBackward, cursorBackwardTab, cursorDown, cursorForward, cursorHide, cursorHorizontalAbsolute, cursorHorizontalForwardTab, cursorLeft, cursorMove, cursorNextLine, cursorPosition, cursorPreviousLine, cursorRestore, // Function
|
|
9
|
-
cursorSave, // Function
|
|
10
|
-
cursorShow, cursorTo, cursorToColumn1, cursorUp, cursorVerticalAbsolute, eraseCharacter, REQUEST_CURSOR_POSITION, REQUEST_EXTENDED_CURSOR_POSITION, RESTORE_CURSOR_DEC, // Constant for ESC 8
|
|
11
|
-
SAVE_CURSOR_DEC, // Constant for ESC 7
|
|
12
|
-
setCursorStyle, } from "./cursor.d.ts";
|
|
13
|
-
export type { EraseDisplayMode, EraseLineMode } from "./erase.d.ts";
|
|
14
|
-
export { eraseDisplay, eraseDown, eraseInLine, eraseLine, eraseLineEnd, eraseLines, eraseLineStart, eraseScreen, eraseScreenAndScrollback, eraseUp, } from "./erase.d.ts";
|
|
15
|
-
export { default as hyperlink } from "./hyperlink.d.ts";
|
|
16
|
-
export type { ImageOptions } from "./image.d.ts";
|
|
17
|
-
export { image } from "./image.d.ts";
|
|
18
|
-
export type { IITerm2Payload, ITerm2FileProperties } from "./iterm2.d.ts";
|
|
19
|
-
export { IT2_AUTO, it2Cells, it2Percent, it2Pixels, iTerm2, ITerm2File, ITerm2FileEnd, ITerm2FilePart, ITerm2MultipartFileStart } from "./iterm2.d.ts";
|
|
20
|
-
export type { AnsiMode, DecMode, Mode, ModeSetting } from "./mode.d.ts";
|
|
21
|
-
export { BDSM, BiDirectionalSupportMode, BracketedPasteMode, createAnsiMode, createDecMode, DECRPM, DECRQM, DisableModifiersMode, InBandResizeMode, InsertReplaceMode, IRM, isModeNotRecognized, isModePermanentlyReset, isModePermanentlySet, isModeReset, isModeSet, KAM, KeyboardActionMode, LightDarkMode, LineFeedNewLineMode, LNM, LocalEchoMode, OriginMode, reportMode, RequestBiDirectionalSupportMode, RequestInBandResizeMode, RequestInsertReplaceMode, RequestKeyboardActionMode, RequestLineFeedNewLineMode, RequestLocalEchoMode, requestMode, RequestSendReceiveMode, RequestUnicodeCoreMode, ResetBiDirectionalSupportMode, ResetInBandResizeMode, ResetInsertReplaceMode, ResetKeyboardActionMode, ResetLineFeedNewLineMode, ResetLocalEchoMode, resetMode, ResetSendReceiveMode, ResetUnicodeCoreMode, RM, SendFocusEventsMode, SendReceiveMode, SetBiDirectionalSupportMode, SetInBandResizeMode, SetInsertReplaceMode, SetKeyboardActionMode, SetLineFeedNewLineMode, SetLocalEchoMode, setMode, SetSendReceiveMode, SetUnicodeCoreMode, SGRMouseMode, SM, SRM, TextCursorEnableMode, UnicodeCoreMode, } from "./mode.d.ts";
|
|
22
|
-
export type { MouseButtonType, MouseModifiers } from "./mouse.d.ts";
|
|
23
|
-
export { disableAnyEventMouse, disableButtonEventMouse, disableFocusTracking, disableNormalMouse, disableSgrMouse, disableX10Mouse, enableAnyEventMouse, enableButtonEventMouse, enableFocusTracking, enableNormalMouse, enableSgrMouse, enableX10Mouse, encodeMouseButtonByte, MouseButton, mouseSgrSequence, mouseX10Sequence, } from "./mouse.d.ts";
|
|
24
|
-
export { SCREEN_MAX_LEN_DEFAULT, SCREEN_TYPICAL_LIMIT, screenPassthrough, tmuxPassthrough } from "./passthrough.d.ts";
|
|
25
|
-
export { resetProgressBar, setErrorProgressBar, setIndeterminateProgressBar, setProgressBar, setWarningProgressBar } from "./progress.d.ts";
|
|
26
|
-
export { RESET_INITIAL_STATE, RIS } from "./reset.d.ts";
|
|
27
|
-
export { clearTabStop, deleteCharacter, deleteLine, insertCharacter, insertLine, repeatPreviousCharacter, requestPresentationStateReport, setLeftRightMargins, setTopBottomMargins, } from "./screen.d.ts";
|
|
28
|
-
export { SCROLL_DOWN_1, SCROLL_UP_1, scrollDown, scrollUp } from "./scroll.d.ts";
|
|
29
|
-
export type { AnsiStatusReport, DecStatusReport, StatusReport } from "./status.d.ts";
|
|
30
|
-
export { CPR, createAnsiStatusReport, createDecStatusReport, cursorPositionReport, DA1, DA2, DA3, DECXCPR, deviceStatusReport, DSR, DSR_KeyboardLanguageDEC, DSR_PrinterStatusDEC, DSR_TerminalStatus, DSR_UDKStatusDEC, extendedCursorPositionReport, LightDarkReport, reportKeyboardLanguageDEC, reportPrimaryDeviceAttributes, reportPrinterNoPaperDEC, reportPrinterNotReadyDEC, reportPrinterReadyDEC, reportSecondaryDeviceAttributes, reportTerminalNotOK, reportTerminalOK, reportTertiaryDeviceAttributes, reportUDKLockedDEC, reportUDKUnlockedDEC, requestCursorPositionReport, requestExtendedCursorPositionReport, requestKeyboardLanguageDEC, RequestLightDarkReport, RequestNameVersion, requestPrimaryDeviceAttributes, requestPrimaryDeviceAttributesParam0, requestPrinterStatusDEC, requestSecondaryDeviceAttributes, requestSecondaryDeviceAttributesParam0, requestTerminalStatus, requestTertiaryDeviceAttributes, requestTertiaryDeviceAttributesParam0, requestUDKStatusDEC, XTVERSION, } from "./status.d.ts";
|
|
31
|
-
export { default as strip } from "./strip.d.ts";
|
|
32
|
-
export { requestTermcap, requestTerminfo, XTGETTCAP } from "./termcap.d.ts";
|
|
33
|
-
export { decsin, decswt, setIconName, setIconNameAndWindowTitle, setIconNameAndWindowTitleWithST, setIconNameWithST, setWindowTitle, setWindowTitleWithST, } from "./title.d.ts";
|
|
34
|
-
export type { XTermWindowOp } from "./window-ops.d.ts";
|
|
35
|
-
export { deiconifyWindow, iconifyWindow, lowerWindow, maximizeWindow, moveWindow, raiseWindow, refreshWindow, reportWindowPosition, reportWindowState, requestCellSizePixels, requestTextAreaSizeChars, requestTextAreaSizePixels, resizeTextAreaChars, resizeTextAreaPixels, restoreMaximizedWindow, setPageSizeLines, xtermWindowOp, XTWINOPS, } from "./window-ops.d.ts";
|
|
36
|
-
export { keyModifierOptions, queryKeyModifierOptions, queryModifyOtherKeys, resetKeyModifierOptions, resetModifyOtherKeys, setKeyModifierOptions, setModifyOtherKeys1, setModifyOtherKeys2, XTMODKEYS, XTQMODKEYS, } from "./xterm.d.ts";
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ALT_SCREEN_OFF as t,ALT_SCREEN_ON as s,alternativeScreenOff as i,alternativeScreenOn as a}from"./alternative-screen.js";import{clearLineAndHomeCursor as d,clearScreenAndHomeCursor as u,clearScreenFromTopLeft as c,resetTerminal as S}from"./clear.js";import{C as M,a as l,b as p,c as m,R as D,x as T,y as E,S as C,d as P,e as A,f as L,g as f,h as y,i as x,j as O,k as b,l as _,m as q,n as I,o as N,p as g,q as w,r as h,s as v,t as U,u as B,v as K,w as W,z as F}from"./packem_shared/cursor-nxpKt8Tn.js";import{eraseDisplay as k,eraseDown as X,eraseInLine as H,eraseLine as Q,eraseLineEnd as V,eraseLineStart as Y,eraseLines as G,eraseScreen as j,eraseScreenAndScrollback as J,eraseUp as Z}from"./erase.js";import{default as ee}from"./hyperlink.js";import{image as oe}from"./image.js";import{iTerm2 as se}from"./iterm2.js";import{BDSM as ae,BiDirectionalSupportMode as ne,BracketedPasteMode as de,DECRPM as ue,DECRQM as ce,DisableModifiersMode as Se,IRM as Re,InBandResizeMode as Me,InsertReplaceMode as le,KAM as pe,KeyboardActionMode as me,LNM as De,LightDarkMode as Te,LineFeedNewLineMode as Ee,LocalEchoMode as Ce,OriginMode as Pe,RM as Ae,RequestBiDirectionalSupportMode as Le,RequestInBandResizeMode as fe,RequestInsertReplaceMode as ye,RequestKeyboardActionMode as xe,RequestLineFeedNewLineMode as Oe,RequestLocalEchoMode as be,RequestSendReceiveMode as _e,RequestUnicodeCoreMode as qe,ResetBiDirectionalSupportMode as Ie,ResetInBandResizeMode as Ne,ResetInsertReplaceMode as ge,ResetKeyboardActionMode as we,ResetLineFeedNewLineMode as he,ResetLocalEchoMode as ve,ResetSendReceiveMode as Ue,ResetUnicodeCoreMode as Be,SGRMouseMode as Ke,SM as We,SRM as Fe,SendFocusEventsMode as ze,SendReceiveMode as ke,SetBiDirectionalSupportMode as Xe,SetInBandResizeMode as He,SetInsertReplaceMode as Qe,SetKeyboardActionMode as Ve,SetLineFeedNewLineMode as Ye,SetLocalEchoMode as Ge,SetSendReceiveMode as je,SetUnicodeCoreMode as Je,TextCursorEnableMode as Ze,UnicodeCoreMode as $e,createAnsiMode as er,createDecMode as rr,isModeNotRecognized as or,isModePermanentlyReset as tr,isModePermanentlySet as sr,isModeReset as ir,isModeSet as ar,reportMode as nr,requestMode as dr,resetMode as ur,setMode as cr}from"./mode.js";import{MouseButton as Rr,disableAnyEventMouse as Mr,disableButtonEventMouse as lr,disableFocusTracking as pr,disableNormalMouse as mr,disableSgrMouse as Dr,disableX10Mouse as Tr,enableAnyEventMouse as Er,enableButtonEventMouse as Cr,enableFocusTracking as Pr,enableNormalMouse as Ar,enableSgrMouse as Lr,enableX10Mouse as fr,encodeMouseButtonByte as yr,mouseSgrSequence as xr,mouseX10Sequence as Or}from"./mouse.js";import{SCREEN_MAX_LEN_DEFAULT as _r,SCREEN_TYPICAL_LIMIT as qr,screenPassthrough as Ir,tmuxPassthrough as Nr}from"./passthrough.js";import{resetProgressBar as wr,setErrorProgressBar as hr,setIndeterminateProgressBar as vr,setProgressBar as Ur,setWarningProgressBar as Br}from"./packem_shared/resetProgressBar-BtBbpWCM.js";import{RESET_INITIAL_STATE as Wr,RIS as Fr}from"./reset.js";import{clearTabStop as kr,deleteCharacter as Xr,deleteLine as Hr,insertCharacter as Qr,insertLine as Vr,repeatPreviousCharacter as Yr,requestPresentationStateReport as Gr,setLeftRightMargins as jr,setTopBottomMargins as Jr}from"./screen.js";import{SCROLL_DOWN_1 as $r,SCROLL_UP_1 as eo,scrollDown as ro,scrollUp as oo}from"./scroll.js";import{CPR as so,DA1 as io,DA2 as ao,DA3 as no,DECXCPR as uo,DSR as co,DSR_KeyboardLanguageDEC as So,DSR_PrinterStatusDEC as Ro,DSR_TerminalStatus as Mo,DSR_UDKStatusDEC as lo,LightDarkReport as po,RequestLightDarkReport as mo,RequestNameVersion as Do,XTVERSION as To,createAnsiStatusReport as Eo,createDecStatusReport as Co,cursorPositionReport as Po,deviceStatusReport as Ao,extendedCursorPositionReport as Lo,reportKeyboardLanguageDEC as fo,reportPrimaryDeviceAttributes as yo,reportPrinterNoPaperDEC as xo,reportPrinterNotReadyDEC as Oo,reportPrinterReadyDEC as bo,reportSecondaryDeviceAttributes as _o,reportTerminalNotOK as qo,reportTerminalOK as Io,reportTertiaryDeviceAttributes as No,reportUDKLockedDEC as go,reportUDKUnlockedDEC as wo,requestCursorPositionReport as ho,requestExtendedCursorPositionReport as vo,requestKeyboardLanguageDEC as Uo,requestPrimaryDeviceAttributes as Bo,requestPrimaryDeviceAttributesParam0 as Ko,requestPrinterStatusDEC as Wo,requestSecondaryDeviceAttributes as Fo,requestSecondaryDeviceAttributesParam0 as zo,requestTerminalStatus as ko,requestTertiaryDeviceAttributes as Xo,requestTertiaryDeviceAttributesParam0 as Ho,requestUDKStatusDEC as Qo}from"./status.js";import{default as Yo}from"./strip.js";import{XTGETTCAP as jo,requestTermcap as Jo,requestTerminfo as Zo}from"./termcap.js";import{decsin as et,decswt as rt,setIconName as ot,setIconNameAndWindowTitle as tt,setIconNameAndWindowTitleWithST as st,setIconNameWithST as it,setWindowTitle as at,setWindowTitleWithST as nt}from"./title.js";import{XTWINOPS as ut,deiconifyWindow as ct,iconifyWindow as St,lowerWindow as Rt,maximizeWindow as Mt,moveWindow as lt,raiseWindow as pt,refreshWindow as mt,reportWindowPosition as Dt,reportWindowState as Tt,requestCellSizePixels as Et,requestTextAreaSizeChars as Ct,requestTextAreaSizePixels as Pt,resizeTextAreaChars as At,resizeTextAreaPixels as Lt,restoreMaximizedWindow as ft,setPageSizeLines as yt,xtermWindowOp as xt}from"./window-ops.js";import{XTMODKEYS as bt,XTQMODKEYS as _t,keyModifierOptions as qt,queryKeyModifierOptions as It,queryModifyOtherKeys as Nt,resetKeyModifierOptions as gt,resetModifyOtherKeys as wt,setKeyModifierOptions as ht,setModifyOtherKeys1 as vt,setModifyOtherKeys2 as Ut}from"./xterm.js";import{IT2_AUTO as Kt,it2Cells as Wt,it2Percent as Ft,it2Pixels as zt}from"./packem_shared/IT2_AUTO-BYrffRAq.js";import{ITerm2File as Xt,ITerm2FileEnd as Ht,ITerm2FilePart as Qt,ITerm2MultipartFileStart as Vt}from"./packem_shared/ITerm2File-C88DBJC-.js";const e="\x07";export{t as ALT_SCREEN_OFF,s as ALT_SCREEN_ON,ae as BDSM,ne as BiDirectionalSupportMode,de as BracketedPasteMode,so as CPR,M as CURSOR_BACKWARD_1,l as CURSOR_DOWN_1,p as CURSOR_FORWARD_1,m as CURSOR_UP_1,io as DA1,ao as DA2,no as DA3,ue as DECRPM,ce as DECRQM,uo as DECXCPR,co as DSR,So as DSR_KeyboardLanguageDEC,Ro as DSR_PrinterStatusDEC,Mo as DSR_TerminalStatus,lo as DSR_UDKStatusDEC,Se as DisableModifiersMode,Re as IRM,Kt as IT2_AUTO,Xt as ITerm2File,Ht as ITerm2FileEnd,Qt as ITerm2FilePart,Vt as ITerm2MultipartFileStart,Me as InBandResizeMode,le as InsertReplaceMode,pe as KAM,me as KeyboardActionMode,De as LNM,Te as LightDarkMode,po as LightDarkReport,Ee as LineFeedNewLineMode,Ce as LocalEchoMode,Rr as MouseButton,Pe as OriginMode,D as REQUEST_CURSOR_POSITION,T as REQUEST_EXTENDED_CURSOR_POSITION,Wr as RESET_INITIAL_STATE,E as RESTORE_CURSOR_DEC,Fr as RIS,Ae as RM,Le as RequestBiDirectionalSupportMode,fe as RequestInBandResizeMode,ye as RequestInsertReplaceMode,xe as RequestKeyboardActionMode,mo as RequestLightDarkReport,Oe as RequestLineFeedNewLineMode,be as RequestLocalEchoMode,Do as RequestNameVersion,_e as RequestSendReceiveMode,qe as RequestUnicodeCoreMode,Ie as ResetBiDirectionalSupportMode,Ne as ResetInBandResizeMode,ge as ResetInsertReplaceMode,we as ResetKeyboardActionMode,he as ResetLineFeedNewLineMode,ve as ResetLocalEchoMode,Ue as ResetSendReceiveMode,Be as ResetUnicodeCoreMode,C as SAVE_CURSOR_DEC,_r as SCREEN_MAX_LEN_DEFAULT,qr as SCREEN_TYPICAL_LIMIT,$r as SCROLL_DOWN_1,eo as SCROLL_UP_1,Ke as SGRMouseMode,We as SM,Fe as SRM,ze as SendFocusEventsMode,ke as SendReceiveMode,Xe as SetBiDirectionalSupportMode,He as SetInBandResizeMode,Qe as SetInsertReplaceMode,Ve as SetKeyboardActionMode,Ye as SetLineFeedNewLineMode,Ge as SetLocalEchoMode,je as SetSendReceiveMode,Je as SetUnicodeCoreMode,Ze as TextCursorEnableMode,$e as UnicodeCoreMode,jo as XTGETTCAP,bt as XTMODKEYS,_t as XTQMODKEYS,To as XTVERSION,ut as XTWINOPS,i as alternativeScreenOff,a as alternativeScreenOn,e as beep,d as clearLineAndHomeCursor,u as clearScreenAndHomeCursor,c as clearScreenFromTopLeft,kr as clearTabStop,er as createAnsiMode,Eo as createAnsiStatusReport,rr as createDecMode,Co as createDecStatusReport,P as cursorBackward,A as cursorBackwardTab,L as cursorDown,f as cursorForward,y as cursorHide,x as cursorHorizontalAbsolute,O as cursorHorizontalForwardTab,b as cursorLeft,_ as cursorMove,q as cursorNextLine,I as cursorPosition,Po as cursorPositionReport,N as cursorPreviousLine,g as cursorRestore,w as cursorSave,h as cursorShow,v as cursorTo,U as cursorToColumn1,B as cursorUp,K as cursorVerticalAbsolute,et as decsin,rt as decswt,ct as deiconifyWindow,Xr as deleteCharacter,Hr as deleteLine,Ao as deviceStatusReport,Mr as disableAnyEventMouse,lr as disableButtonEventMouse,pr as disableFocusTracking,mr as disableNormalMouse,Dr as disableSgrMouse,Tr as disableX10Mouse,Er as enableAnyEventMouse,Cr as enableButtonEventMouse,Pr as enableFocusTracking,Ar as enableNormalMouse,Lr as enableSgrMouse,fr as enableX10Mouse,yr as encodeMouseButtonByte,W as eraseCharacter,k as eraseDisplay,X as eraseDown,H as eraseInLine,Q as eraseLine,V as eraseLineEnd,Y as eraseLineStart,G as eraseLines,j as eraseScreen,J as eraseScreenAndScrollback,Z as eraseUp,Lo as extendedCursorPositionReport,ee as hyperlink,se as iTerm2,St as iconifyWindow,oe as image,Qr as insertCharacter,Vr as insertLine,or as isModeNotRecognized,tr as isModePermanentlyReset,sr as isModePermanentlySet,ir as isModeReset,ar as isModeSet,Wt as it2Cells,Ft as it2Percent,zt as it2Pixels,qt as keyModifierOptions,Rt as lowerWindow,Mt as maximizeWindow,xr as mouseSgrSequence,Or as mouseX10Sequence,lt as moveWindow,It as queryKeyModifierOptions,Nt as queryModifyOtherKeys,pt as raiseWindow,mt as refreshWindow,Yr as repeatPreviousCharacter,fo as reportKeyboardLanguageDEC,nr as reportMode,yo as reportPrimaryDeviceAttributes,xo as reportPrinterNoPaperDEC,Oo as reportPrinterNotReadyDEC,bo as reportPrinterReadyDEC,_o as reportSecondaryDeviceAttributes,qo as reportTerminalNotOK,Io as reportTerminalOK,No as reportTertiaryDeviceAttributes,go as reportUDKLockedDEC,wo as reportUDKUnlockedDEC,Dt as reportWindowPosition,Tt as reportWindowState,Et as requestCellSizePixels,ho as requestCursorPositionReport,vo as requestExtendedCursorPositionReport,Uo as requestKeyboardLanguageDEC,dr as requestMode,Gr as requestPresentationStateReport,Bo as requestPrimaryDeviceAttributes,Ko as requestPrimaryDeviceAttributesParam0,Wo as requestPrinterStatusDEC,Fo as requestSecondaryDeviceAttributes,zo as requestSecondaryDeviceAttributesParam0,Jo as requestTermcap,ko as requestTerminalStatus,Zo as requestTerminfo,Xo as requestTertiaryDeviceAttributes,Ho as requestTertiaryDeviceAttributesParam0,Ct as requestTextAreaSizeChars,Pt as requestTextAreaSizePixels,Qo as requestUDKStatusDEC,gt as resetKeyModifierOptions,ur as resetMode,wt as resetModifyOtherKeys,wr as resetProgressBar,S as resetTerminal,At as resizeTextAreaChars,Lt as resizeTextAreaPixels,ft as restoreMaximizedWindow,Ir as screenPassthrough,ro as scrollDown,oo as scrollUp,F as setCursorStyle,hr as setErrorProgressBar,ot as setIconName,tt as setIconNameAndWindowTitle,st as setIconNameAndWindowTitleWithST,it as setIconNameWithST,vr as setIndeterminateProgressBar,ht as setKeyModifierOptions,jr as setLeftRightMargins,cr as setMode,vt as setModifyOtherKeys1,Ut as setModifyOtherKeys2,yt as setPageSizeLines,Ur as setProgressBar,Jr as setTopBottomMargins,Br as setWarningProgressBar,at as setWindowTitle,nt as setWindowTitleWithST,Yo as strip,Nr as tmuxPassthrough,xt as xtermWindowOp};
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import type { LiteralUnion } from "type-fest";
|
|
2
|
-
/**
|
|
3
|
-
* Represents the special string value `'auto'` used for iTerm2 image or file dimensions.
|
|
4
|
-
* When `'auto'` is used for width or height, the terminal (iTerm2) determines the appropriate dimension
|
|
5
|
-
* based on the image's inherent size or other context.
|
|
6
|
-
* @example `width: IT2_AUTO`
|
|
7
|
-
*/
|
|
8
|
-
export declare const IT2_AUTO: string;
|
|
9
|
-
/**
|
|
10
|
-
* Formats a number as a string representing a dimension in character cells for iTerm2.
|
|
11
|
-
* iTerm2 interprets plain numbers for width/height as character cell counts.
|
|
12
|
-
* @param n The number of character cells.
|
|
13
|
-
* @returns A string representation of the number (e.g., `10` becomes `"10"`).
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const widthInCells = it2Cells(20); // "20"
|
|
17
|
-
* const sequence = `File=width=${widthInCells}`;
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare const it2Cells: (n: number) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Formats a number as a string representing a dimension in pixels for iTerm2.
|
|
23
|
-
* Appends `px` to the number.
|
|
24
|
-
* @param n The number of pixels.
|
|
25
|
-
* @returns A string representing the dimension in pixels (e.g., `100` becomes `"100px"`).
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const heightInPixels = it2Pixels(150);
|
|
29
|
-
* const sequence = `File=height=${heightInPixels}`;
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare const it2Pixels: (n: number) => string;
|
|
33
|
-
/**
|
|
34
|
-
* Formats a number as a string representing a dimension as a percentage for iTerm2.
|
|
35
|
-
* Appends `%` to the number.
|
|
36
|
-
* @param n The percentage value (e.g., `50` for 50%).
|
|
37
|
-
* @returns A string representing the dimension as a percentage (e.g., `50` becomes `"50%"`).
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* const widthAsPercentage = it2Percent(75);
|
|
41
|
-
* const sequence = `File=width=${widthAsPercentage}`;
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare const it2Percent: (n: number) => string;
|
|
45
|
-
/**
|
|
46
|
-
* Defines the interface for any iTerm2 OSC 1337 payload object.
|
|
47
|
-
*
|
|
48
|
-
* An OSC 1337 sequence has the general form: `OSC 1337 ; <payload_string> BEL`.
|
|
49
|
-
* Objects implementing this interface are responsible for generating that `<payload_string>`
|
|
50
|
-
* via their `toString()` method. This allows for a structured way to build various iTerm2 commands.
|
|
51
|
-
* @see {@link iTerm2} function which consumes objects of this type.
|
|
52
|
-
*/
|
|
53
|
-
export interface IITerm2Payload {
|
|
54
|
-
/**
|
|
55
|
-
* Converts the payload object into its specific string representation required for an iTerm2 OSC 1337 command.
|
|
56
|
-
* For example, for a file transfer, this might return `"File=name=...;size=...:content..."`.
|
|
57
|
-
* @returns The string payload part of the OSC 1337 sequence.
|
|
58
|
-
*/
|
|
59
|
-
toString: () => string;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Defines the properties for an iTerm2 file transfer or inline image display command (`File=...`).
|
|
63
|
-
* These correspond to the key-value pairs used within the `File=` argument of the OSC 1337 sequence.
|
|
64
|
-
* @see {@link https://iterm2.com/documentation-escape-codes.html} iTerm2 Escape Codes (search for `File=`)
|
|
65
|
-
* @see {@link https://iterm2.com/documentation-images.html} iTerm2 Inline Images Protocol
|
|
66
|
-
*/
|
|
67
|
-
export interface ITerm2FileProperties {
|
|
68
|
-
/**
|
|
69
|
-
* The Base64 encoded content of the file or image.
|
|
70
|
-
* This is typically used when `inline=1` is set for images, or for transferring small files directly
|
|
71
|
-
* within the escape sequence. For larger files, multipart transfer is recommended.
|
|
72
|
-
* @remarks The `ITerm2File` class can handle the Base64 encoding of `Uint8Array` data automatically.
|
|
73
|
-
*/
|
|
74
|
-
content?: string;
|
|
75
|
-
/**
|
|
76
|
-
* If `true`, instructs the terminal not to move the cursor after displaying an inline image.
|
|
77
|
-
* Corresponds to `doNotMoveCursor=1` in the sequence.
|
|
78
|
-
* This is a WezTerm extension, also supported by iTerm2 beta/nightly builds as of some versions.
|
|
79
|
-
* @default false (cursor behavior is default terminal behavior)
|
|
80
|
-
*/
|
|
81
|
-
doNotMoveCursor?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* The display height of the image or file placeholder.
|
|
84
|
-
* Can be:
|
|
85
|
-
* - A number (interpreted as character cells, e.g., `10`).
|
|
86
|
-
* - A string with units: `"Npx"` (N pixels), `"N%"` (N percent of session height).
|
|
87
|
-
* - The string {@link IT2_AUTO} (`"auto"`) for automatic sizing.
|
|
88
|
-
* Use helper functions like {@link it2Cells}, {@link it2Pixels}, {@link it2Percent} for formatting if needed.
|
|
89
|
-
* @example `10`, `"100px"`, `"50%"`, `IT2_AUTO`
|
|
90
|
-
*/
|
|
91
|
-
height?: LiteralUnion<typeof IT2_AUTO, number | string>;
|
|
92
|
-
/**
|
|
93
|
-
* Controls aspect ratio preservation for inline images.
|
|
94
|
-
* - If `true` (or omitted), the aspect ratio *is* preserved (`preserveAspectRatio=1`, which is the default iTerm2 behavior if the param is absent).
|
|
95
|
-
* - If `false`, the aspect ratio is *not* preserved, and the image may stretch (`preserveAspectRatio=0`).
|
|
96
|
-
* @remarks Note the slight inversion: this property `ignoreAspectRatio: true` means `preserveAspectRatio=0` in the sequence.
|
|
97
|
-
* The default iTerm2 behavior *is* to preserve aspect ratio if the `preserveAspectRatio` parameter is not given.
|
|
98
|
-
* So, to *not* preserve, you set this to true to *add* `preserveAspectRatio=0`.
|
|
99
|
-
* If you want to preserve (default), you can omit this or set it to `false`.
|
|
100
|
-
* @default false (meaning aspect ratio is preserved by iTerm2 default unless overridden)
|
|
101
|
-
*/
|
|
102
|
-
ignoreAspectRatio?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* If `true`, the file (typically an image) should be displayed inline in the terminal.
|
|
105
|
-
* Corresponds to `inline=1` in the sequence.
|
|
106
|
-
* If `false` or omitted, iTerm2 might prompt for download or handle based on file type.
|
|
107
|
-
* @default false
|
|
108
|
-
*/
|
|
109
|
-
inline?: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* The name of the file. This is displayed in UI elements (like a download prompt or image info)
|
|
112
|
-
* and used as the default filename if downloaded.
|
|
113
|
-
* The name **must be Base64 encoded** if it contains special characters (like `;`, `=`, or non-ASCII characters)
|
|
114
|
-
* to ensure correct parsing of the escape sequence by iTerm2.
|
|
115
|
-
* The `ITerm2File` and `ITerm2MultipartFileStart` classes generally expect the name to be pre-encoded if necessary.
|
|
116
|
-
* @example `"bXlmaWxlLnR4dA=="` (Base64 for "myfile.txt")
|
|
117
|
-
*/
|
|
118
|
-
name?: string;
|
|
119
|
-
/**
|
|
120
|
-
* The size of the file in bytes. This is used by iTerm2 for progress indication during downloads
|
|
121
|
-
* or to inform inline display mechanisms.
|
|
122
|
-
* JavaScript `number` type is generally sufficient for typical file sizes (up to `Number.MAX_SAFE_INTEGER`).
|
|
123
|
-
*/
|
|
124
|
-
size?: number;
|
|
125
|
-
/**
|
|
126
|
-
* The display width of the image or file placeholder.
|
|
127
|
-
* Can be:
|
|
128
|
-
* - A number (interpreted as character cells, e.g., `20`).
|
|
129
|
-
* - A string with units: `"Npx"` (N pixels), `"N%"` (N percent of session width).
|
|
130
|
-
* - The string {@link IT2_AUTO} (`"auto"`) for automatic sizing.
|
|
131
|
-
* Use helper functions like {@link it2Cells}, {@link it2Pixels}, {@link it2Percent} for formatting if needed.
|
|
132
|
-
* @example `20`, `"200px"`, `"75%"`, `IT2_AUTO`
|
|
133
|
-
*/
|
|
134
|
-
width?: LiteralUnion<typeof IT2_AUTO, number | string>;
|
|
135
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { IITerm2Payload, ITerm2FileProperties } from "./iterm2-properties.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Represents the payload for a complete iTerm2 file transfer or an inline image display command.
|
|
4
|
-
* This class is used to construct the part of the OSC 1337 sequence that follows `File=`.
|
|
5
|
-
* The generated payload can be either:
|
|
6
|
-
* - `File=[PROPERTIES]:[BASE64_CONTENT]` (for inline content)
|
|
7
|
-
* - `File=[PROPERTIES]` (if content is not provided directly, e.g., for a download announcement)
|
|
8
|
-
*
|
|
9
|
-
* Implements {@link IITerm2Payload} for use with the generic `iTerm2` function.
|
|
10
|
-
* @see {@link ITerm2FileProps} for property details.
|
|
11
|
-
* @see {@link iTerm2} for the function that wraps this payload into a full escape sequence.
|
|
12
|
-
*/
|
|
13
|
-
export declare class ITerm2File implements IITerm2Payload {
|
|
14
|
-
private readonly fileProps;
|
|
15
|
-
/**
|
|
16
|
-
* Constructs an `ITerm2File` payload object.
|
|
17
|
-
* @param properties An object containing properties for the file/image, as defined by {@link ITerm2FileProps}.
|
|
18
|
-
* The `name` property within `props` should be pre-Base64 encoded by the caller if it might
|
|
19
|
-
* contain special characters (like `;`, `=`, or non-ASCII characters).
|
|
20
|
-
* If `fileData` is provided, `props.content` will be overridden, and `props.size` will be
|
|
21
|
-
* set from `fileData.byteLength` if not already present in `props`.
|
|
22
|
-
* @param fileData (Optional) A `Uint8Array` containing the raw file data. If provided, this data will be
|
|
23
|
-
* Base64 encoded and used as the `content` of the file transfer. The `size` property
|
|
24
|
-
* will also be automatically set from `fileData.byteLength` if not specified in `props`.
|
|
25
|
-
*/
|
|
26
|
-
constructor(properties: ITerm2FileProperties, fileData?: Uint8Array);
|
|
27
|
-
/**
|
|
28
|
-
* Converts the file properties and its content (if any) into the string payload
|
|
29
|
-
* suitable for the iTerm2 `File=` command.
|
|
30
|
-
* @returns The string payload (e.g., `"File=name=...;size=...:BASE64_CONTENT"` or `"File=name=...;size=..."`).
|
|
31
|
-
*/
|
|
32
|
-
toString(): string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Represents the payload for ending an iTerm2 multipart file transfer.
|
|
36
|
-
* This class is used to construct the part of the OSC 1337 sequence that is simply `FileEnd`.
|
|
37
|
-
*
|
|
38
|
-
* Implements {@link IITerm2Payload} for use with the generic `iTerm2` function.
|
|
39
|
-
* @see {@link ITerm2MultipartFileStart} to initiate the transfer.
|
|
40
|
-
* @see {@link ITerm2FilePart} for sending file chunks.
|
|
41
|
-
*/
|
|
42
|
-
export declare class ITerm2FileEnd implements IITerm2Payload {
|
|
43
|
-
/**
|
|
44
|
-
* Generates the string payload for the iTerm2 `FileEnd` command.
|
|
45
|
-
* @returns The string `"FileEnd"`.
|
|
46
|
-
*/
|
|
47
|
-
toString(): string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Represents the payload for a part (chunk) of an iTerm2 multipart file transfer.
|
|
51
|
-
* This class is used to construct the part of the OSC 1337 sequence that follows `FilePart=`.
|
|
52
|
-
* The provided chunk must already be Base64 encoded.
|
|
53
|
-
*
|
|
54
|
-
* Implements {@link IITerm2Payload} for use with the generic `iTerm2` function.
|
|
55
|
-
* @see {@link ITerm2MultipartFileStart} to initiate the transfer.
|
|
56
|
-
* @see {@link ITerm2FileEnd} to finalize the transfer.
|
|
57
|
-
*/
|
|
58
|
-
export declare class ITerm2FilePart implements IITerm2Payload {
|
|
59
|
-
private readonly base64Chunk;
|
|
60
|
-
/**
|
|
61
|
-
* Constructs an `ITerm2FilePart` payload object.
|
|
62
|
-
* @param base64Chunk A string containing a Base64 encoded chunk of the file data.
|
|
63
|
-
* The caller is responsible for chunking the file and Base64 encoding each chunk.
|
|
64
|
-
*/
|
|
65
|
-
constructor(base64Chunk: string);
|
|
66
|
-
/**
|
|
67
|
-
* Converts the Base64 encoded chunk into the string payload suitable for the iTerm2 `FilePart=` command.
|
|
68
|
-
* @returns The string payload (e.g., `"FilePart=U09NRURBVEE="`).
|
|
69
|
-
*/
|
|
70
|
-
toString(): string;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Represents the payload for starting an iTerm2 multipart file transfer.
|
|
74
|
-
* This class is used to construct the part of the OSC 1337 sequence that follows `MultipartFile=`.
|
|
75
|
-
* This command initiates a transfer; the actual file data is sent in subsequent `FilePart` commands.
|
|
76
|
-
*
|
|
77
|
-
* Implements {@link IITerm2Payload} for use with the generic `iTerm2` function.
|
|
78
|
-
* @see {@link ITerm2FileProps} for property details (omitting `content`).
|
|
79
|
-
* @see {@link ITerm2FilePart} for sending file chunks.
|
|
80
|
-
* @see {@link ITerm2FileEnd} for finalizing the transfer.
|
|
81
|
-
*/
|
|
82
|
-
export declare class ITerm2MultipartFileStart implements IITerm2Payload {
|
|
83
|
-
private readonly properties;
|
|
84
|
-
/**
|
|
85
|
-
* Constructs an `ITerm2MultipartFileStart` payload object.
|
|
86
|
-
* @param properties Properties for the multipart file (e.g., `name`, `size`). Content is not part of this command.
|
|
87
|
-
* The `name` property within `props` should be pre-Base64 encoded by the caller if it might
|
|
88
|
-
* contain special characters.
|
|
89
|
-
*/
|
|
90
|
-
constructor(properties: Omit<ITerm2FileProperties, "content">);
|
|
91
|
-
/**
|
|
92
|
-
* Converts the file properties into the string payload suitable for the iTerm2 `MultipartFile=` command.
|
|
93
|
-
* @returns The string payload (e.g., `"MultipartFile=name=...;size=..."`).
|
|
94
|
-
*/
|
|
95
|
-
toString(): string;
|
|
96
|
-
}
|
package/dist/iterm2.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { IITerm2Payload } from './iterm2/iterm2-properties.d.ts';
|
|
2
|
-
export type { IITerm2Payload, ITerm2FileProperties } from './iterm2/iterm2-properties.d.ts';
|
|
3
|
-
export { IT2_AUTO, it2Cells, it2Percent, it2Pixels } from './iterm2/iterm2-properties.d.ts';
|
|
4
|
-
export { ITerm2File, ITerm2FileEnd, ITerm2FilePart, ITerm2MultipartFileStart } from './iterm2/iterm2-sequences.d.ts';
|
|
5
|
-
/**
|
|
6
|
-
* Generates a complete iTerm2 proprietary escape sequence (OSC 1337).
|
|
7
|
-
*
|
|
8
|
-
* This function serves as a general-purpose constructor for iTerm2 escape codes.
|
|
9
|
-
* It takes a payload object that conforms to the {@link IITerm2Payload} interface.
|
|
10
|
-
* The `toString()` method of this payload object is responsible for generating the
|
|
11
|
-
* specific command and arguments part of the sequence (e.g., `File=...`, `ShellIntegrationVersion=...`).
|
|
12
|
-
*
|
|
13
|
-
* The overall structure of the generated sequence is: `OSC 1337 ; <PAYLOAD_STRING> BEL`
|
|
14
|
-
* (`OSC` is `\x1b]`, `BEL` is `\x07`).
|
|
15
|
-
* @param payload An object that implements the {@link IITerm2Payload} interface.
|
|
16
|
-
* This object must have a `toString()` method that returns the string representation
|
|
17
|
-
* of the iTerm2 command-specific payload.
|
|
18
|
-
* Examples include instances of `ITerm2File`, `ITerm2MultipartFileStart`, etc.
|
|
19
|
-
* @returns The fully formed ANSI escape sequence for the iTerm2 command.
|
|
20
|
-
* Returns an empty string if the provided `payload` is invalid (e.g., null, undefined,
|
|
21
|
-
* lacks a proper `toString` method, or its `toString` method is the generic `Object.prototype.toString`).
|
|
22
|
-
* @see {@link https://iterm2.com/documentation-escape-codes.html iTerm2 Escape Codes Documentation}
|
|
23
|
-
* for a comprehensive list of supported commands and their payloads.
|
|
24
|
-
* @see {@link IITerm2Payload} for the interface requirement.
|
|
25
|
-
* @see Classes like {@link ITerm2File}, {@link ITerm2MultipartFileStart}, {@link ITerm2FilePart}, {@link ITerm2FileEnd}
|
|
26
|
-
* for concrete examples of payload objects.
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import { iTerm2, ITerm2File, ITerm2FileProps } from '@visulima/ansi/iterm2'; // ITerm2FileProps can be used for options
|
|
30
|
-
* import { Buffer } from 'node:buffer';
|
|
31
|
-
*
|
|
32
|
-
* // Example 1: Sending a file inline (like an image)
|
|
33
|
-
* const imageName = "my_image.png";
|
|
34
|
-
* const imageData = Buffer.from("dummyimagecontent"); // Replace with actual Uint8Array image data
|
|
35
|
-
* const imageFileProps: ITerm2FileProps = { // Use ITerm2FileProps for broader options
|
|
36
|
-
* name: Buffer.from(imageName).toString("base64"), // Name should be base64 encoded
|
|
37
|
-
* inline: true,
|
|
38
|
-
* width: "50%",
|
|
39
|
-
* height: "auto",
|
|
40
|
-
* ignoreAspectRatio: false, // Equivalent to preserveAspectRatio: true
|
|
41
|
-
* };
|
|
42
|
-
* const filePayload = new ITerm2File(imageFileProps, imageData);
|
|
43
|
-
* const imageSequence = iTerm2(filePayload);
|
|
44
|
-
* console.log(imageSequence);
|
|
45
|
-
* // Expected output (simplified, actual base64 will be longer):
|
|
46
|
-
* // OSC1337;File=name=bXlfaW1hZ2UucG5n;inline=1;width=50%;height=auto:ZHVtbXlpbWFnZWNvbnRlbnQ=BEL
|
|
47
|
-
* // Note: if ignoreAspectRatio was true, preserveAspectRatio=0 would be in the sequence.
|
|
48
|
-
*
|
|
49
|
-
* // Example 2: A hypothetical simple command (e.g., shell integration handshake)
|
|
50
|
-
* const shellIntegrationPayload: IITerm2Payload = {
|
|
51
|
-
* toString: () => "ShellIntegrationVersion=15;Shell=zsh"
|
|
52
|
-
* };
|
|
53
|
-
* const shellSequence = iTerm2(shellIntegrationPayload);
|
|
54
|
-
* console.log(shellSequence);
|
|
55
|
-
* // Output: OSC1337;ShellIntegrationVersion=15;Shell=zshBEL
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare const iTerm2: (payload: IITerm2Payload) => string;
|
package/dist/iterm2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var r=(t,e)=>i(t,"name",{value:e,configurable:!0});import{O as o,B as m}from"./packem_shared/constants-D12jy2Zh.js";import{IT2_AUTO as I,it2Cells as c,it2Percent as s,it2Pixels as S}from"./packem_shared/IT2_AUTO-BYrffRAq.js";import{ITerm2File as g,ITerm2FileEnd as y,ITerm2FilePart as O,ITerm2MultipartFileStart as P}from"./packem_shared/ITerm2File-C88DBJC-.js";var n=Object.defineProperty,a=r((t,e)=>n(t,"name",{value:e,configurable:!0}),"t");const T=a(t=>{if(!t||typeof t.toString!="function"||t.toString===Object.prototype.toString)throw new Error("Invalid payload: must implement IITerm2Payload with a custom toString method");return`${o}1337;${t.toString()}${m}`},"iTerm2");export{I as IT2_AUTO,g as ITerm2File,y as ITerm2FileEnd,O as ITerm2FilePart,P as ITerm2MultipartFileStart,T as iTerm2,c as it2Cells,s as it2Percent,S as it2Pixels};
|