Update xterm libary to 4.17

This commit is contained in:
Will Owens 2022-02-26 20:08:53 -05:00
parent ab9ea2b95f
commit bba352a2eb
14 changed files with 2735 additions and 2352 deletions

File diff suppressed because one or more lines are too long

87
js/dist/gotty-bundle.js.LICENSE.txt vendored Normal file
View file

@ -0,0 +1,87 @@
/*!
* libapps (https://npmjs.com/package/libapps)
* @license BSD-3-Clause
* @version 1.70.0
* ==libapps/LICENSE==
* // Copyright (c) 2006-2009 The Chromium OS Authors. All rights reserved.
* //
* // Redistribution and use in source and binary forms, with or without
* // modification, are permitted provided that the following conditions are
* // met:
* //
* // * Redistributions of source code must retain the above copyright
* // notice, this list of conditions and the following disclaimer.
* // * Redistributions in binary form must reproduce the above
* // copyright notice, this list of conditions and the following disclaimer
* // in the documentation and/or other materials provided with the
* // distribution.
* // * Neither the name of Google Inc. nor the names of its
* // contributors may be used to endorse or promote products derived from
* // this software without specific prior written permission.
* //
* // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*!
* xterm (https://npmjs.com/package/xterm)
* @license MIT
* @version 4.17.0
* ==xterm/LICENSE==
* Copyright (c) 2017-2019, The xterm.js authors (https://github.com/xtermjs/xterm.js)
* Copyright (c) 2014-2016, SourceLair Private Company (https://www.sourcelair.com)
* Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/)
*
* 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:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 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.
*/
/*!
* xterm-addon-fit (https://npmjs.com/package/xterm-addon-fit)
* @license MIT
* @version 0.5.0
* ==xterm-addon-fit/LICENSE==
* Copyright (c) 2019, The xterm.js authors (https://github.com/xtermjs/xterm.js)
*
* 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:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 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.
*/

1
js/dist/gotty-bundle.js.map vendored Normal file

File diff suppressed because one or more lines are too long

1
js/dist/main.d.ts vendored
View file

@ -0,0 +1 @@
export {};

10
js/dist/xterm.d.ts vendored
View file

@ -1,13 +1,17 @@
import * as bare from "xterm";
/// <reference types="node" />
import { lib } from "libapps";
import { IDisposable, Terminal } from 'xterm';
import { FitAddon } from "xterm-addon-fit";
export declare class Xterm {
elem: HTMLElement;
term: bare;
term: Terminal;
resizeListener: () => void;
decoder: lib.UTF8Decoder;
message: HTMLElement;
messageTimeout: number;
messageTimer: number;
messageTimer: NodeJS.Timer;
fitAddon: FitAddon;
disposables: IDisposable[];
constructor(elem: HTMLElement);
info(): {
columns: number;

4601
js/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,14 @@
{
"devDependencies": {
"license-loader": "^0.5.0",
"ts-loader": "^2.0.3",
"typescript": "^2.3.2",
"uglifyjs-webpack-plugin": "^1.0.0-beta.2",
"webpack": "^2.5.1"
"ts-loader": "^9.1.2",
"typescript": "^4.4.4",
"webpack": "^5",
"webpack-cli": "^4.9.2"
},
"dependencies": {
"libapps": "github:yudai/libapps#release-hterm-1.70",
"xterm": "^2.7.0"
"xterm": "^4.17",
"xterm-addon-fit": "^0.5.0"
}
}

View file

@ -59,8 +59,8 @@ export class WebTTY {
open() {
let connection = this.connectionFactory.create();
let pingTimer: number;
let reconnectTimeout: number;
let pingTimer: NodeJS.Timer;
let reconnectTimeout: NodeJS.Timeout;
const setup = () => {
connection.onOpen(() => {

View file

@ -1,40 +1,52 @@
import * as bare from "xterm";
import { lib } from "libapps"
import {lib} from "libapps";
import {IDisposable, Terminal} from 'xterm';
import {FitAddon} from "xterm-addon-fit";
bare.loadAddon("fit");
export class Xterm {
elem: HTMLElement;
term: bare;
term: Terminal;
resizeListener: () => void;
decoder: lib.UTF8Decoder;
message: HTMLElement;
messageTimeout: number;
messageTimer: number;
messageTimer: NodeJS.Timer;
fitAddon: FitAddon;
disposables: IDisposable[] = [];
constructor(elem: HTMLElement) {
this.elem = elem;
this.term = new bare();
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0;
this.term = new Terminal({
cursorStyle: "block",
cursorBlink: true,
windowsMode: isWindows,
fontFamily: "DejaVu Sans Mono, Everson Mono, FreeMono, Menlo, Terminal, monospace, Apple Symbols",
fontSize: 12,
});
this.fitAddon = new FitAddon();
this.term.loadAddon(this.fitAddon);
this.message = elem.ownerDocument.createElement("div");
this.message.className = "xterm-overlay";
this.messageTimeout = 2000;
this.resizeListener = () => {
this.term.fit();
this.fitAddon.fit();
this.term.scrollToBottom();
this.showMessage(String(this.term.cols) + "x" + String(this.term.rows), this.messageTimeout);
};
this.term.on("open", () => {
this.resizeListener();
window.addEventListener("resize", () => { this.resizeListener(); });
});
this.term.open(elem);
this.term.open(elem, true);
this.term.focus()
this.resizeListener();
window.addEventListener("resize", () => { this.resizeListener(); });
this.decoder = new lib.UTF8Decoder()
};
@ -75,21 +87,20 @@ export class Xterm {
};
onInput(callback: (input: string) => void) {
this.term.on("data", (data) => {
callback(data);
});
this.disposables.push(this.term.onData((data) => {
callback(data);
}));
};
onResize(callback: (colmuns: number, rows: number) => void) {
this.term.on("resize", (data) => {
callback(data.cols, data.rows);
});
this.disposables.push(this.term.onResize((data) => {
callback(data.cols, data.rows);
}));
};
deactivate(): void {
this.term.off("data");
this.term.off("resize");
this.disposables.forEach(d => d.dispose())
this.term.blur();
}
@ -100,6 +111,6 @@ export class Xterm {
close(): void {
window.removeEventListener("resize", this.resizeListener);
this.term.destroy();
this.term.dispose();
}
}

View file

@ -1,29 +1,30 @@
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
entry: "./src/main.ts",
output: {
filename: "./dist/gotty-bundle.js"
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/
},
{
test: /\.js$/,
include: /node_modules/,
loader: 'license-loader'
}
]
},
plugins: [
new UglifyJSPlugin()
entry: "./src/main.ts",
output: {
filename: "./gotty-bundle.js"
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/
},
{
test: /\.js$/,
include: /node_modules/,
loader: 'license-loader'
}
]
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
}
};