Bundle hterm

This commit is contained in:
Iwasaki Yudai 2017-08-22 15:56:56 +09:00
parent 8f95182392
commit 70aaf33082
24 changed files with 18056 additions and 520 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "libapps"]
path = js/libapps
url = https://chromium.googlesource.com/apps/libapps

View File

@ -7,7 +7,7 @@ gotty: server/asset.go main.go server/*.go webtty/*.go backend/*.go Makefile
asset: server/asset.go
server/asset.go: bindata/static/js/hterm.js bindata/static/js/bundle.js bindata/static/index.html bindata/static/favicon.png bindata/static/css/index.css bindata/static/css/xterm.css bindata/static/css/xterm_customize.css
server/asset.go: bindata/static/js/bundle.js bindata/static/index.html bindata/static/favicon.png bindata/static/css/index.css bindata/static/css/xterm.css bindata/static/css/xterm_customize.css
go-bindata -prefix bindata -pkg server -ignore=\\.gitkeep -o server/asset.go bindata/...
gofmt -w server/asset.go
@ -26,9 +26,6 @@ bindata/static/favicon.png: bindata/static resources/favicon.png
bindata/static/js: bindata/static
mkdir -p bindata/static/js
bindata/static/js/hterm.js: bindata/static/js js/libapps/hterm/js/*.js
cd js/libapps && \
LIBDOT_SEARCH_PATH=`pwd` ./libdot/bin/concat.sh -i ./hterm/concat/hterm_all.concat -o ../../bindata/static/js/hterm.js
bindata/static/js/bundle.js: bindata/static/js js/dist/bundle.js
cp js/dist/bundle.js bindata/static/js/bundle.js

18098
js/dist/bundle.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

2
js/dist/hterm.d.ts vendored
View File

@ -1,4 +1,4 @@
import * as bare from "hterm";
import * as bare from "libapps";
export declare class TermHterm {
elem: HTMLElement;
term: bare.Terminal;

77
js/dist/hterm.js vendored
View File

@ -1,77 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bare = require("hterm");
var TermHterm = (function () {
function TermHterm(elem) {
var _this = this;
this.elem = elem;
this.term = new bare.Terminal();
// this.term.defaultStorage = new lib.Storage.Memory();
this.term.getPrefs().set("send-encoding", "raw");
this.term.decorate(this.elem);
this.term.onTerminalReady = function () {
_this.io = _this.term.io.push();
_this.term.installKeyboard();
};
}
;
TermHterm.prototype.info = function () {
return { columns: this.term.screen.getWidth(), rows: this.term.screen.getHeight() };
};
;
TermHterm.prototype.output = function (data) {
if (this.term.io.writeUTF8 != null) {
this.term.io.writeUTF8(data);
}
};
;
TermHterm.prototype.showMessage = function (message, timeout) {
this.term.io.showOverlay(message, timeout);
};
;
TermHterm.prototype.removeMessage = function () {
this.term.io.showOverlay("", 0);
};
TermHterm.prototype.setWindowTitle = function (title) {
this.term.setWindowTitle(title);
};
;
TermHterm.prototype.setPreferences = function (value) {
var _this = this;
Object.keys(value).forEach(function (key) {
_this.term.getPrefs().set(key, value[key]);
});
};
;
TermHterm.prototype.onInput = function (callback) {
this.io.onVTKeystroke = function (data) {
callback(data);
};
this.io.sendString = function (data) {
callback(data);
};
};
;
TermHterm.prototype.onResize = function (callback) {
this.io.onTerminalResize = function (columns, rows) {
callback(columns, rows);
};
};
;
TermHterm.prototype.deactivate = function () {
this.io.onVTKeystroke = null;
this.io.sendString = null;
this.io.onTerminalResize = null;
this.term.uninstallKeyboard();
};
TermHterm.prototype.reset = function () {
this.removeMessage();
// this.term.reset();
};
TermHterm.prototype.close = function () {
this.term.uninstallKeyboard();
};
return TermHterm;
}());
exports.TermHterm = TermHterm;
//# sourceMappingURL=hterm.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"hterm.js","sourceRoot":"","sources":["../src/hterm.ts"],"names":[],"mappings":";;AAAA,4BAA8B;AAE9B;IAMI,mBAAY,IAAiB;QAA7B,iBAWC;QAVG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QACxC,8DAA8D;QACtD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,C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AAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IAEF,2BAAO,GAAP,UAAQ,QAAiC;QACrC,IAAI,CAAC,EAAE,CAAC,aAAa,GAAG,UAAC,IAAI;YACzB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC;QACF,IAAI,CAAC,EAAE,CAAC,UAAU,GAAG,UAAC,IAAI;YACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC;IACN,CAAC;IAAA,CAAC;IAEF,4BAAQ,GAAR,UAAS,QAAiD;QACtD,IAAI,CAAC,EAAE,CAAC,gBAAgB,GAAG,UAAC,OAAe,EAAE,IAAY;YACrD,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACN,CAAC;IAAA,CAAC;IAEF,8BAAU,GAAV;QACI,IAAI,CAAC,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,UAAU,GAAG,IAAI,CAAA;QACzB,IAAI,CAAC,EAAE,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IAED,yBAAK,GAAL;QACI,IAAI,CAAC,aAAa,EAAE,CAAC;QAC7B,4BAA4B;IACxB,CAAC;IAED,yBAAK,GAAL;QACI,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IACL,gBAAC;AAAD,CAAC,AA7ED,IA6EC;AA7EY,8BAAS"}

23
js/dist/main.js vendored
View File

@ -1,23 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var hterm_1 = require("./hterm");
var xterm_1 = require("./xterm");
var webtty_1 = require("./webtty");
var websocket_1 = require("./websocket");
var elem = document.getElementById("terminal");
if (elem !== null) {
var term_1 = new xterm_1.TermXterm(elem);
var httpsEnabled = window.location.protocol == "https:";
var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.hostname + ":8080/ws";
var args = window.location.search;
var factory = new websocket_1.ConnectionFactory(url, webtty_1.protocols);
var wt = new webtty_1.WebTTY(term_1, factory, args, "");
var closer_1 = wt.open();
new hterm_1.TermHterm(elem);
window.addEventListener("unload", function () {
closer_1();
term_1.close();
});
}
;
//# sourceMappingURL=main.js.map

1
js/dist/main.js.map vendored
View File

@ -1 +0,0 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,iCAAoC;AACpC,iCAAoC;AACpC,mCAA6C;AAC7C,yCAAgD;AAGhD,IAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;AAEhD,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAChB,IAAM,MAAI,GAAG,IAAI,iBAAS,CAAC,IAAI,CAAC,CAAC;IACjC,IAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC;IAC1D,IAAM,GAAG,GAAG,CAAC,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,UAAU,CAAC;IACxF,IAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpC,IAAM,OAAO,GAAG,IAAI,6BAAiB,CAAC,GAAG,EAAE,kBAAS,CAAC,CAAC;IACtD,IAAM,EAAE,GAAG,IAAI,eAAM,CAAC,MAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAC/C,IAAM,QAAM,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IAEzB,IAAI,iBAAS,CAAC,IAAI,CAAC,CAAC;IAEpB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE;QAC9B,QAAM,EAAE,CAAC;QACT,MAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAAA,CAAC"}

60
js/dist/websocket.js vendored
View File

@ -1,60 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ConnectionFactory = (function () {
function ConnectionFactory(url, protocols) {
this.url = url;
this.protocols = protocols;
}
;
ConnectionFactory.prototype.create = function () {
return new Connection(this.url, this.protocols);
};
;
return ConnectionFactory;
}());
exports.ConnectionFactory = ConnectionFactory;
var Connection = (function () {
function Connection(url, protocols) {
this.bare = new WebSocket(url, protocols);
}
Connection.prototype.open = function () {
// nothing todo for websocket
};
;
Connection.prototype.close = function () {
this.bare.close();
};
;
Connection.prototype.send = function (data) {
this.bare.send(data);
};
;
Connection.prototype.isOpen = function () {
if (this.bare.readyState == WebSocket.CONNECTING ||
this.bare.readyState == WebSocket.OPEN) {
return true;
}
return false;
};
Connection.prototype.onOpen = function (callback) {
this.bare.onopen = function (event) {
callback();
};
};
;
Connection.prototype.onReceive = function (callback) {
this.bare.onmessage = function (event) {
callback(event.data);
};
};
;
Connection.prototype.onClose = function (callback) {
this.bare.onclose = function (event) {
callback();
};
};
;
return Connection;
}());
exports.Connection = Connection;
//# sourceMappingURL=websocket.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../src/websocket.ts"],"names":[],"mappings":";;AAAA;IAII,2BAAY,GAAW,EAAE,SAAmB;QACxC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF,kCAAM,GAAN;QACI,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAAA,CAAC;IACN,wBAAC;AAAD,CAAC,AAZD,IAYC;AAZY,8CAAiB;AAc9B;IAII,oB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, "__esModule", { value: true });
exports.protocols = ["webtty"];
exports.msgInputUnknown = '0';
exports.msgInput = '1';
exports.msgPing = '2';
exports.msgResizeTerminal = '3';
exports.msgUnknownOutput = '0';
exports.msgOutput = '1';
exports.msgPong = '2';
exports.msgSetWindowTitle = '3';
exports.msgSetPreferences = '4';
exports.msgSetReconnect = '5';
var WebTTY = (function () {
function WebTTY(term, connectionFactory, args, authToken) {
this.term = term;
this.connectionFactory = connectionFactory;
this.args = args;
this.authToken = authToken;
this.reconnect = -1;
}
;
WebTTY.prototype.open = function () {
var _this = this;
var connection = this.connectionFactory.create();
var pingTimer;
var reconnectTimeout;
var setup = function () {
connection.onOpen(function () {
var termInfo = _this.term.info();
connection.send(JSON.stringify({
Arguments: _this.args,
AuthToken: _this.authToken,
}));
var resizeHandler = function (colmuns, rows) {
connection.send(exports.msgResizeTerminal + JSON.stringify({
columns: colmuns,
rows: rows
}));
};
_this.term.onResize(resizeHandler);
resizeHandler(termInfo.columns, termInfo.rows);
_this.term.onInput(function (input) {
connection.send(exports.msgInput + input);
});
pingTimer = setInterval(function () {
connection.send(exports.msgPing);
}, 30 * 1000);
});
connection.onReceive(function (data) {
var payload = data.slice(1);
switch (data[0]) {
case exports.msgOutput:
_this.term.output(decodeURIComponent(Array.prototype.map.call(atob(payload), function (c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join('')));
break;
case exports.msgPong:
break;
case exports.msgSetWindowTitle:
_this.term.setWindowTitle(payload);
break;
case exports.msgSetPreferences:
var preferences = JSON.parse(payload);
_this.term.setPreferences(preferences);
break;
case exports.msgSetReconnect:
var autoReconnect = JSON.parse(payload);
console.log("Enabling reconnect: " + autoReconnect + " seconds");
_this.reconnect = autoReconnect;
break;
}
});
connection.onClose(function () {
clearInterval(pingTimer);
_this.term.deactivate();
_this.term.showMessage("Connection Closed", 0);
if (_this.reconnect > 0) {
reconnectTimeout = setTimeout(function () {
connection = _this.connectionFactory.create();
_this.term.reset();
setup();
}, _this.reconnect * 1000);
}
});
connection.open();
};
setup();
return function () {
clearTimeout(reconnectTimeout);
connection.close();
};
};
;
return WebTTY;
}());
exports.WebTTY = WebTTY;
;
//# sourceMappingURL=webtty.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"webtty.js","sourceRoot":"","sources":["../src/webtty.ts"],"names":[],"mappings":";;AAAa,QAAA,SAAS,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEvB,QAAA,eAAe,GAAG,GAAG,CAAC;AACtB,QAAA,QAAQ,GAAG,GAAG,CAAC;AACf,QAAA,OAAO,GAAG,GAAG,CAAC;AACd,QAAA,iBAAiB,GAAG,GAAG,CAAC;AAExB,QAAA,gBAAgB,GAAG,GAAG,CAAC;AACvB,QAAA,SAAS,GAAG,GAAG,CAAC;AAChB,QAAA,OAAO,GAAG,GAAG,CAAC;AACd,QAAA,iBAAiB,GAAG,GAAG,CAAC;AACxB,QAAA,iBAAiB,GAAG,GAAG,CAAC;AACxB,QAAA,eAAe,GAAG,GAAG,CAAC;AAgCnC;IAOI,gBAAY,IAAc,EAAE,iBAAoC,EAAE,IAAY,EAAE,SAAiB;QAC7F,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACxB,CAAC;IAAA,CAAC;IAEF,qBAAI,GAAJ;QAAA,iBA2FC;QA1FG,IAAI,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;QACjD,IAAI,SAAiB,CAAC;QACtB,IAAI,gBAAwB,CAAC;QAE7B,IAAM,KAAK,GAAG;YACV,UAAU,CAAC,MAAM,CAAC;gBACd,IAAM,QAAQ,GAAG,KAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAElC,U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B,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,UAAU,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC,CAAA;QAED,KAAK,EAAE,CAAC;QACR,MAAM,CAAC;YACH,YAAY,CAAC,gBAAgB,CAAC,CAAC;YAC/B,UAAU,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC,CAAA;IACL,CAAC;IAAA,CAAC;IACN,aAAC;AAAD,CAAC,AA3GD,IA2GC;AA3GY,wBAAM;AA2GlB,CAAC"}

88
js/dist/xterm.js vendored
View File

@ -1,88 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bare = require("xterm");
bare.loadAddon("fit");
var TermXterm = (function () {
function TermXterm(elem) {
var _this = this;
this.elem = elem;
this.term = new bare();
this.message = elem.ownerDocument.createElement("div");
this.message.className = "xterm-overlay";
this.messageTimeout = 2000;
this.resizeListener = function () {
_this.term.fit();
_this.term.scrollToBottom();
_this.showMessage(String(_this.term.cols) + "x" + String(_this.term.rows), _this.messageTimeout);
};
this.term.on("open", function () {
_this.term.fit();
_this.term.scrollToBottom();
window.addEventListener("resize", function () { _this.resizeListener(); });
});
this.term.open(elem, true);
}
;
TermXterm.prototype.info = function () {
return { columns: this.term.cols, rows: this.term.rows };
};
;
TermXterm.prototype.output = function (data) {
this.term.write(data);
};
;
TermXterm.prototype.showMessage = function (message, timeout) {
var _this = this;
this.message.textContent = message;
this.elem.appendChild(this.message);
if (this.messageTimer) {
clearTimeout(this.messageTimer);
}
if (timeout > 0) {
this.messageTimer = setTimeout(function () {
_this.elem.removeChild(_this.message);
}, timeout);
}
};
;
TermXterm.prototype.removeMessage = function () {
if (this.message.parentNode == this.elem) {
this.elem.removeChild(this.message);
}
};
TermXterm.prototype.setWindowTitle = function (title) {
document.title = title;
};
;
TermXterm.prototype.setPreferences = function (value) {
};
;
TermXterm.prototype.onInput = function (callback) {
this.term.on("data", function (data) {
callback(data);
});
};
;
TermXterm.prototype.onResize = function (callback) {
this.term.on("resize", function (data) {
callback(data.cols, data.rows);
});
};
;
TermXterm.prototype.deactivate = function () {
this.term.off("data");
this.term.off("resize");
this.term.blur();
};
TermXterm.prototype.reset = function () {
this.removeMessage();
this.term.clear();
};
TermXterm.prototype.close = function () {
window.removeEventListener("resize", this.resizeListener);
this.term.destroy();
};
return TermXterm;
}());
exports.TermXterm = TermXterm;
//# sourceMappingURL=xterm.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"xterm.js","sourceRoot":"","sources":["../src/xterm.ts"],"names":[],"mappings":";;AAAA,4BAA8B;AAE9B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEtB;IAUI,mBAAY,IAAiB;QAA7B,iBAsBC;QArBG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAEvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,eAAe,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAG3B,IAAI,CAAC,cAAc,GAAG;YAClB,KAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAChB,KAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YAC3B,KAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAI,CAAC,cAAc,CAAC,CAAC;QACjG,CAAC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;YACjB,KAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAChB,KAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YAC3B,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE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AED,kCAAc,GAAd,UAAe,KAAa;QACxB,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,CAAC;IAAA,CAAC;IAEF,kCAAc,GAAd,UAAe,KAAa;IAC5B,CAAC;IAAA,CAAC;IAEF,2BAAO,GAAP,UAAQ,QAAiC;QACrC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;YACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IAEP,CAAC;IAAA,CAAC;IAEF,4BAAQ,GAAR,UAAS,QAAiD;QACtD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAC,IAAI;YACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IAEF,8BAAU,GAAV;QACI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED,yBAAK,GAAL;QACI,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,yBAAK,GAAL;QACI,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IACL,gBAAC;AAAD,CAAC,AAjGD,IAiGC;AAjGY,8BAAS"}

@ -1 +0,0 @@
Subproject commit f05b714d7ff1368b3669b041ae83fcaec1742a61

3
js/package-lock.json generated
View File

@ -890,6 +890,9 @@
"invert-kv": "1.0.0"
}
},
"libapps": {
"version": "github:yudai/libapps#424e3e95e5346ef0c0c281aaf2ef73463a55b39e"
},
"load-json-file": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",

View File

@ -5,6 +5,7 @@
"webpack": "^2.5.1"
},
"dependencies": {
"libapps": "github:yudai/libapps#hterm-1.70",
"xterm": "^2.7.0"
}
}

View File

@ -1,5 +1,4 @@
import * as bare from "hterm";
import * as bareLib from "htermLib";
import * as bare from "libapps";
export class TermHterm {
elem: HTMLElement;
@ -15,8 +14,8 @@ export class TermHterm {
constructor(elem: HTMLElement) {
this.elem = elem;
hterm.defaultStorage = new bareLib.Storage.Memory();
this.term = new bare.Terminal();
bare.hterm.defaultStorage = new bare.lib.Storage.Memory();
this.term = new bare.hterm.Terminal();
this.term.getPrefs().set("send-encoding", "raw");
this.term.decorate(this.elem);

View File

@ -1,47 +0,0 @@
export interface Terminal {
io: IO;
onTerminalReady: () => void;
getPrefs(): Prefs;
decorate(HTMLElement);
installKeyboard(): void;
uninstallKeyboard(): void;
setWindowTitle(title: string): void;
reset(): void;
softReset(): void;
}
export interface TerminalConstructor {
new (): Terminal;
(): Terminal;
}
export interface IO {
writeUTF8: ((data: string) => void);
writeUTF16: ((data: string) => void);
onVTKeystroke: ((data: string) => void) | null;
sendString: ((data: string) => void) | null;
onTerminalResize: ((columns: number, rows: number) => void) | null;
push(): IO;
writeUTF(data: string);
showOverlay(message: string, timeout: number | null);
}
export interface Prefs {
set(key: string, value: string): void;
}
export interface Storage {
}
export var Terminal: TerminalConstructor;
// @TODO: is there better way?
// exported variables are forced to be read-protected.
declare global {
var hterm: {
defaultStorage: Storage;
};
}

View File

@ -1,11 +0,0 @@
export interface Storage {
}
export interface Memory {
new (): Storage;
Memory(): Storage
}
export var Storage: {
Memory: Memory
};

View File

@ -3,10 +3,6 @@ module.exports = {
output: {
filename: "./dist/bundle.js"
},
externals: {
"hterm": "hterm",
"htermLib": "lib"
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js"],

View File

@ -6,7 +6,6 @@
<link rel="stylesheet" href="./css/index.css" />
<link rel="stylesheet" href="./css/xterm.css" />
<link rel="stylesheet" href="./css/xterm_customize.css" />
<script src="/js/hterm.js"></script>
</head>
<body>
<div id="terminal"></div>

File diff suppressed because one or more lines are too long