@visulima/ansi 4.0.0-alpha.2 → 4.0.0-alpha.3
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 +12 -0
- package/dist/alternative-screen.d.ts +74 -0
- package/dist/alternative-screen.js +1 -0
- package/dist/clear.d.ts +77 -0
- package/dist/clear.js +1 -0
- package/dist/constants.d.ts +20 -0
- package/dist/cursor.d.ts +437 -0
- package/dist/cursor.js +1 -0
- package/dist/erase.d.ts +206 -0
- package/dist/erase.js +1 -0
- package/dist/helpers.d.ts +14 -0
- package/dist/hyperlink.d.ts +27 -0
- package/dist/hyperlink.js +1 -0
- package/dist/image.d.ts +73 -0
- package/dist/image.js +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +1 -0
- package/dist/iterm2/iterm2-properties.d.ts +135 -0
- package/dist/iterm2/iterm2-sequences.d.ts +96 -0
- package/dist/iterm2.d.ts +58 -0
- package/dist/iterm2.js +1 -0
- package/dist/mode.d.ts +726 -0
- package/dist/mode.js +1 -0
- package/dist/mouse.d.ts +230 -0
- package/dist/mouse.js +1 -0
- package/dist/packem_shared/IT2_AUTO-BYrffRAq.js +1 -0
- package/dist/packem_shared/ITerm2File-C88DBJC-.js +1 -0
- package/dist/packem_shared/constants-D12jy2Zh.js +1 -0
- package/dist/packem_shared/cursor-nxpKt8Tn.js +1 -0
- package/dist/packem_shared/resetProgressBar-BtBbpWCM.js +1 -0
- package/dist/packem_shared/restoreCursor-CHy0jZuu.js +2 -0
- package/dist/passthrough.d.ts +77 -0
- package/dist/passthrough.js +1 -0
- package/dist/progress.d.ts +41 -0
- package/dist/reset.d.ts +26 -0
- package/dist/reset.js +1 -0
- package/dist/screen.d.ts +234 -0
- package/dist/screen.js +1 -0
- package/dist/scroll.d.ts +67 -0
- package/dist/scroll.js +1 -0
- package/dist/status.d.ts +524 -0
- package/dist/status.js +1 -0
- package/dist/strip.d.ts +23 -0
- package/dist/strip.js +1 -0
- package/dist/termcap.d.ts +38 -0
- package/dist/termcap.js +1 -0
- package/dist/title.d.ts +185 -0
- package/dist/title.js +1 -0
- package/dist/window-ops.d.ts +418 -0
- package/dist/window-ops.js +1 -0
- package/dist/xterm.d.ts +94 -0
- package/dist/xterm.js +1 -0
- package/package.json +1 -46
package/dist/iterm2.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
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};
|