mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Use scoped packages, fix some typing issues
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "xterm-addon-attach",
|
||||
"name": "@xterm/addon-attach",
|
||||
"version": "0.1.0-beta8",
|
||||
"author": {
|
||||
"name": "The xterm.js authors",
|
||||
+3
-8
@@ -12,11 +12,6 @@ interface IAttachOptions {
|
||||
inputUtf8?: boolean;
|
||||
}
|
||||
|
||||
// TODO: To be removed once UTF8 PR is in xterm.js package.
|
||||
interface INewTerminal extends Terminal {
|
||||
writeUtf8(data: Uint8Array): void;
|
||||
}
|
||||
|
||||
export class AttachAddon implements ITerminalAddon {
|
||||
private _socket: WebSocket;
|
||||
private _bidirectional: boolean;
|
||||
@@ -34,14 +29,14 @@ export class AttachAddon implements ITerminalAddon {
|
||||
public activate(terminal: Terminal): void {
|
||||
if (this._utf8) {
|
||||
this._disposables.push(addSocketListener(this._socket, 'message',
|
||||
(ev: MessageEvent | Event | CloseEvent) => (terminal as INewTerminal).writeUtf8(new Uint8Array((ev as any).data as ArrayBuffer))));
|
||||
(ev: MessageEvent | Event | CloseEvent) => terminal.writeUtf8(new Uint8Array((ev as any).data as ArrayBuffer))));
|
||||
} else {
|
||||
this._disposables.push(addSocketListener(this._socket, 'message',
|
||||
(ev: MessageEvent | Event | CloseEvent) => (terminal as INewTerminal).write((ev as any).data as string)));
|
||||
(ev: MessageEvent | Event | CloseEvent) => terminal.write((ev as any).data as string)));
|
||||
}
|
||||
|
||||
if (this._bidirectional) {
|
||||
this._disposables.push(terminal.addDisposableListener('data', data => this._sendData(data)));
|
||||
this._disposables.push(terminal.onData(data => this._sendData(data)));
|
||||
}
|
||||
|
||||
this._disposables.push(addSocketListener(this._socket, 'close', () => this.dispose()));
|
||||
+1
-1
@@ -14,6 +14,6 @@
|
||||
},
|
||||
"include": [
|
||||
"./**/*",
|
||||
"../../../typings/xterm.d.ts"
|
||||
"../../../../typings/xterm.d.ts"
|
||||
]
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { Terminal, ILinkMatcherOptions, ITerminalAddon } from 'xterm';
|
||||
|
||||
declare module '@xterm/addon-attach' {
|
||||
export interface IAttachOptions {
|
||||
/**
|
||||
* Whether input should be written to the backend. Defaults to `true`.
|
||||
*/
|
||||
bidirectional?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to use UTF8 binary transport for incoming messages. Defaults to `false`.
|
||||
* Note: This must be in line with the server side of the websocket.
|
||||
* Always send string messages from the backend if this options is false,
|
||||
* otherwise always binary UTF8 data.
|
||||
*/
|
||||
inputUtf8?: boolean;
|
||||
}
|
||||
|
||||
export class AttachAddon implements ITerminalAddon {
|
||||
constructor(socket: WebSocket, options?: IAttachOptions);
|
||||
public activate(terminal: Terminal): void;
|
||||
public dispose(): void;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "xterm-addon-fit",
|
||||
"name": "@xterm/addon-fit",
|
||||
"version": "0.1.0-beta7",
|
||||
"author": {
|
||||
"name": "The xterm.js authors",
|
||||
+1
-1
@@ -14,6 +14,6 @@
|
||||
},
|
||||
"include": [
|
||||
"./**/*",
|
||||
"../../../typings/xterm.d.ts"
|
||||
"../../../../typings/xterm.d.ts"
|
||||
]
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Terminal, ITerminalAddon } from 'xterm';
|
||||
|
||||
declare module 'xterm-addon-fit' {
|
||||
declare module '@xterm/addon-fit' {
|
||||
/**
|
||||
* An xterm.js addon that enables resizing the terminal to the dimensions of
|
||||
* its containing element.
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "xterm-addon-search",
|
||||
"name": "@xterm/addon-search",
|
||||
"version": "0.1.0-beta4",
|
||||
"author": {
|
||||
"name": "The xterm.js authors",
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user