UNPKG

@tsports/go-osc52

Version:

OSC52 terminal clipboard escape sequences - TypeScript port of go-osc52

103 lines 3.57 kB
import { type Sequence as CoreSequence } from './core.js'; import { Clipboard, Mode, Operation, type Writer } from './types.js'; /** * Go-compatible Sequence class that matches the original Go API exactly. * All method names match the Go implementation. */ export declare class Sequence { private readonly _seq; constructor(seq: CoreSequence); /** * String returns the OSC52 sequence as a string. * This matches the Go String() method exactly. */ String(): string; /** * WriteTo writes the OSC52 sequence to the writer. * This matches the Go WriteTo(io.Writer) method. * @param writer The writer to write to * @returns Promise resolving to the number of bytes written and any error */ WriteTo(writer: Writer): Promise<{ n: number; err?: Error; }>; /** * Mode sets the mode for the OSC52 sequence. * @param m The mode to set * @returns A new Sequence instance with the updated mode */ Mode(m: Mode): Sequence; /** * Tmux sets the mode to TmuxMode. * This is syntactic sugar for Mode(TmuxMode). */ Tmux(): Sequence; /** * Screen sets the mode to ScreenMode. * This is syntactic sugar for Mode(ScreenMode). */ Screen(): Sequence; /** * Clipboard sets the clipboard buffer for the OSC52 sequence. * @param c The clipboard buffer to use */ Clipboard(c: Clipboard): Sequence; /** * Primary sets the clipboard buffer to PrimaryClipboard. * This is syntactic sugar for Clipboard(PrimaryClipboard). */ Primary(): Sequence; /** * Limit sets the limit for the OSC52 sequence. * @param l The limit to set */ Limit(l: number): Sequence; /** * Operation sets the operation for the OSC52 sequence. * @param o The operation to set */ Operation(o: Operation): Sequence; /** * Clear sets the operation to ClearOperation. * This is syntactic sugar for Operation(ClearOperation). */ Clear(): Sequence; /** * Query sets the operation to QueryOperation. * This is syntactic sugar for Operation(QueryOperation). */ Query(): Sequence; /** * SetString sets the string for the OSC52 sequence. * @param strs The strings to join with space character */ SetString(...strs: string[]): Sequence; } /** * New creates a new OSC52 sequence with the given string(s). * Strings are joined with a space character. * This matches the Go New(...string) function exactly. * @param strs The strings to include in the sequence */ export declare function New(...strs: string[]): Sequence; /** * Query creates a new OSC52 sequence with the QueryOperation. * This matches the Go Query() function exactly. */ export declare function Query(): Sequence; /** * Clear creates a new OSC52 sequence with the ClearOperation. * This matches the Go Clear() function exactly. */ export declare function Clear(): Sequence; export { Clipboard, Mode, Operation, } from './types.js'; export declare const SystemClipboard = Clipboard.SystemClipboard; export declare const PrimaryClipboard = Clipboard.PrimaryClipboard; export declare const DefaultMode = Mode.DefaultMode; export declare const ScreenMode = Mode.ScreenMode; export declare const TmuxMode = Mode.TmuxMode; export declare const SetOperation = Operation.SetOperation; export declare const QueryOperation = Operation.QueryOperation; export declare const ClearOperation = Operation.ClearOperation; //# sourceMappingURL=go-style.d.ts.map