├── .gitattributes ├── .gitignore ├── README.md ├── app.py ├── requirements.txt ├── static ├── js │ └── jquery-1.12.4.js └── xterm │ ├── LICENSE │ ├── README.md │ ├── bower.json │ ├── dist │ ├── addons │ │ ├── attach │ │ │ ├── attach.js │ │ │ └── package.json │ │ ├── fit │ │ │ ├── fit.js │ │ │ └── package.json │ │ ├── fullscreen │ │ │ ├── fullscreen.css │ │ │ ├── fullscreen.js │ │ │ └── package.json │ │ ├── linkify │ │ │ └── linkify.js │ │ ├── search │ │ │ ├── search.js │ │ │ └── search.js.map │ │ └── terminado │ │ │ ├── package.json │ │ │ └── terminado.js │ ├── xterm.css │ ├── xterm.js │ └── xterm.js.map │ ├── gulpfile.js │ ├── jsdoc.json │ ├── lib │ ├── Buffer.js │ ├── Buffer.js.map │ ├── Buffer.test.js │ ├── Buffer.test.js.map │ ├── BufferSet.js │ ├── BufferSet.js.map │ ├── BufferSet.test.js │ ├── BufferSet.test.js.map │ ├── Charsets.js │ ├── Charsets.js.map │ ├── CompositionHelper.js │ ├── CompositionHelper.js.map │ ├── CompositionHelper.test.js │ ├── CompositionHelper.test.js.map │ ├── EscapeSequences.js │ ├── EscapeSequences.js.map │ ├── EventEmitter.js │ ├── EventEmitter.js.map │ ├── EventEmitter.test.js │ ├── EventEmitter.test.js.map │ ├── InputHandler.js │ ├── InputHandler.js.map │ ├── InputHandler.test.js │ ├── InputHandler.test.js.map │ ├── Interfaces.js │ ├── Interfaces.js.map │ ├── Linkifier.js │ ├── Linkifier.js.map │ ├── Linkifier.test.js │ ├── Linkifier.test.js.map │ ├── Parser.js │ ├── Parser.js.map │ ├── Renderer.js │ ├── Renderer.js.map │ ├── SelectionManager.js │ ├── SelectionManager.js.map │ ├── SelectionManager.test.js │ ├── SelectionManager.test.js.map │ ├── SelectionModel.js │ ├── SelectionModel.js.map │ ├── SelectionModel.test.js │ ├── SelectionModel.test.js.map │ ├── Types.js │ ├── Types.js.map │ ├── Viewport.js │ ├── Viewport.js.map │ ├── Viewport.test.js │ ├── Viewport.test.js.map │ ├── addons │ │ ├── attach │ │ │ ├── attach.js │ │ │ └── package.json │ │ ├── fit │ │ │ ├── fit.js │ │ │ └── package.json │ │ ├── fullscreen │ │ │ ├── fullscreen.css │ │ │ ├── fullscreen.js │ │ │ └── package.json │ │ ├── search │ │ │ ├── SearchHelper.js │ │ │ ├── SearchHelper.js.map │ │ │ ├── search.js │ │ │ └── search.js.map │ │ └── terminado │ │ │ ├── package.json │ │ │ └── terminado.js │ ├── handlers │ │ ├── Clipboard.js │ │ ├── Clipboard.js.map │ │ ├── Clipboard.test.js │ │ └── Clipboard.test.js.map │ ├── test │ │ ├── addons │ │ │ ├── test.js │ │ │ └── test.js.map │ │ ├── escape-sequences-test.js │ │ ├── escape-sequences-test.js.map │ │ ├── test.js │ │ └── test.js.map │ ├── utils │ │ ├── Browser.js │ │ ├── Browser.js.map │ │ ├── BufferLine.js │ │ ├── BufferLine.js.map │ │ ├── CharMeasure.js │ │ ├── CharMeasure.js.map │ │ ├── CharMeasure.test.js │ │ ├── CharMeasure.test.js.map │ │ ├── CircularList.js │ │ ├── CircularList.js.map │ │ ├── CircularList.test.js │ │ ├── CircularList.test.js.map │ │ ├── DomElementObjectPool.js │ │ ├── DomElementObjectPool.js.map │ │ ├── DomElementObjectPool.test.js │ │ ├── DomElementObjectPool.test.js.map │ │ ├── Generic.js │ │ ├── Generic.js.map │ │ ├── Mouse.js │ │ ├── Mouse.js.map │ │ ├── TestUtils.js │ │ └── TestUtils.js.map │ ├── xterm.css │ ├── xterm.js │ └── xterm.js.map │ ├── package.json │ ├── src │ ├── Buffer.test.ts │ ├── Buffer.ts │ ├── BufferSet.test.ts │ ├── BufferSet.ts │ ├── Charsets.ts │ ├── CompositionHelper.test.ts │ ├── CompositionHelper.ts │ ├── EscapeSequences.ts │ ├── EventEmitter.test.ts │ ├── EventEmitter.ts │ ├── InputHandler.test.ts │ ├── InputHandler.ts │ ├── Interfaces.ts │ ├── Linkifier.test.ts │ ├── Linkifier.ts │ ├── Parser.ts │ ├── Renderer.ts │ ├── SelectionManager.test.ts │ ├── SelectionManager.ts │ ├── SelectionModel.test.ts │ ├── SelectionModel.ts │ ├── Types.ts │ ├── Viewport.test.ts │ ├── Viewport.ts │ ├── addons │ │ ├── attach │ │ │ ├── attach.js │ │ │ └── package.json │ │ ├── fit │ │ │ ├── fit.js │ │ │ └── package.json │ │ ├── fullscreen │ │ │ ├── fullscreen.css │ │ │ ├── fullscreen.js │ │ │ └── package.json │ │ ├── search │ │ │ ├── SearchHelper.ts │ │ │ ├── search.ts │ │ │ └── tsconfig.json │ │ └── terminado │ │ │ ├── package.json │ │ │ └── terminado.js │ ├── handlers │ │ ├── Clipboard.test.ts │ │ └── Clipboard.ts │ ├── test │ │ ├── addons │ │ │ └── test.js │ │ ├── escape-sequences-test.js │ │ └── test.js │ ├── utils │ │ ├── Browser.ts │ │ ├── BufferLine.ts │ │ ├── CharMeasure.test.ts │ │ ├── CharMeasure.ts │ │ ├── CircularList.test.ts │ │ ├── CircularList.ts │ │ ├── DomElementObjectPool.test.ts │ │ ├── DomElementObjectPool.ts │ │ ├── Generic.ts │ │ ├── Mouse.ts │ │ └── TestUtils.ts │ ├── xterm.css │ └── xterm.js │ ├── tsconfig.json │ ├── tslint.json │ └── typings.json ├── templates ├── index.html └── terminal.html └── utility ├── __init__.py ├── k8s.py └── log.py /.gitattributes: -------------------------------------------------------------------------------- 1 | static/* linguist-vendored 2 | templates/* linguist-vendored 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | __pycache__ 3 | venv 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # K8S web terminal 2 | A light K8S web terminal demo. 3 | 4 | The demo refer to personal blog https://blog.csdn.net/duxiangwushirenfei/article/details/83341574. 5 | 6 | Please visit link given to get detail. 7 | 8 | # Optimize 9 | 10 | 1, CPU Occupation 11 | 12 | Refer to issue: https://github.com/wushirenfei/k8s-web-terminal/issues/1, 13 | it'll consistently occupy server cup resource, when read data from container by using `while True`. 14 | 15 | This will be resolve by use IO multiplexing just as epoll or select. 16 | 17 | You can get container connection socket object in Stream object by `stream.sock.sock`, for example use `select` implement async read listen. 18 | 19 | ```python 20 | 21 | class NewK8sThread(threading.Thread): 22 | 23 | def __init__(self, ws, stream): 24 | super(NewK8sThread, self).__init__() 25 | self.ws = ws 26 | self.stream = stream 27 | self.selector = select.epoll() 28 | 29 | 30 | def read(self): 31 | self.selector.register(self.stream.sock.sock.fileno(), 32 | selectors.EVENT_READ, 33 | self.readable) 34 | 35 | def readable(self): 36 | self.selector.unregister(self.stream.sock.sock.fileno()) 37 | data = self.stream.read_stdout() 38 | self.ws.send(data) 39 | 40 | def run(self): 41 | self.read() 42 | 43 | ``` 44 | 45 | Above `NewK8sThread` just a pseudocode demo cannot run immediately. 46 | 47 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | # -*- coding=utf-8 -*- 2 | # Copyright 2018 Alex Ma 3 | 4 | """ 5 | :author Alex Ma 6 | :date 2018/10/15 7 | 8 | """ 9 | from werkzeug import serving 10 | from flask_sockets import Sockets 11 | from flask import Flask, render_template 12 | from utility.log import log 13 | from utility.k8s import K8SClient, K8SStreamThread 14 | 15 | app = Flask(__name__, static_folder='static', 16 | static_url_path='/terminal/static') 17 | sockets = Sockets(app) 18 | 19 | 20 | @app.route('/terminal/', methods=['GET']) 21 | def index(): 22 | return render_template('index.html') 23 | 24 | 25 | @app.route('/terminal/window', methods=['GET']) 26 | def terminal(): 27 | return render_template('terminal.html') 28 | 29 | 30 | @sockets.route('/terminal///') 31 | def terminal_socket(ws, namespace, pod, container): 32 | log.info('Try create socket connection') 33 | ssl_ca_cert, key_file, cert_file = K8SClient.gen_ca() 34 | kub = K8SClient( 35 | api_host='kubernetes_api_url', 36 | ssl_ca_cert=ssl_ca_cert, 37 | key_file=key_file, 38 | cert_file=cert_file) 39 | 40 | try: 41 | container_stream = kub.terminal_start(namespace, pod, container) 42 | except Exception as err: 43 | log.error('Connect container error: {}'.format(err)) 44 | ws.close() 45 | return 46 | 47 | kub_stream = K8SStreamThread(ws, container_stream) 48 | kub_stream.start() 49 | 50 | log.info('Start terminal') 51 | try: 52 | while not ws.closed: 53 | message = ws.receive() 54 | if message is not None: 55 | if message != '__ping__': 56 | container_stream.write_stdin(message) 57 | container_stream.write_stdin('exit\r') 58 | except Exception as err: 59 | log.error('Connect container error: {}'.format(err)) 60 | finally: 61 | container_stream.close() 62 | ws.close() 63 | 64 | 65 | @serving.run_with_reloader 66 | def run_server(): 67 | app.debug = True 68 | from gevent import pywsgi 69 | from geventwebsocket.handler import WebSocketHandler 70 | server = pywsgi.WSGIServer( 71 | listener = ('0.0.0.0', 5000), 72 | application=app, 73 | handler_class=WebSocketHandler) 74 | server.serve_forever() 75 | 76 | 77 | if __name__ == '__main__': 78 | run_server() 79 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==1.0.2 2 | Flask-Sockets==0.2.1 3 | docker==3.5.0 4 | kubernetes==7.0.0 5 | Werkzeug==0.14.1 6 | -------------------------------------------------------------------------------- /static/xterm/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2016, SourceLair Private Company (https://www.sourcelair.com) 2 | Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /static/xterm/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.js", 3 | "version": "2.9.2", 4 | "ignore": ["demo", "test", ".gitignore"], 5 | "main": [ 6 | "dist/xterm.js", 7 | "dist/xterm.css" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/attach/attach.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implements the attach method, that attaches the terminal to a WebSocket stream. 3 | * @module xterm/addons/attach/attach 4 | * @license MIT 5 | */ 6 | 7 | (function (attach) { 8 | if (typeof exports === 'object' && typeof module === 'object') { 9 | /* 10 | * CommonJS environment 11 | */ 12 | module.exports = attach(require('../../xterm')); 13 | } else if (typeof define == 'function') { 14 | /* 15 | * Require.js is available 16 | */ 17 | define(['../../xterm'], attach); 18 | } else { 19 | /* 20 | * Plain browser environment 21 | */ 22 | attach(window.Terminal); 23 | } 24 | })(function (Xterm) { 25 | 'use strict'; 26 | 27 | var exports = {}; 28 | 29 | /** 30 | * Attaches the given terminal to the given socket. 31 | * 32 | * @param {Xterm} term - The terminal to be attached to the given socket. 33 | * @param {WebSocket} socket - The socket to attach the current terminal. 34 | * @param {boolean} bidirectional - Whether the terminal should send data 35 | * to the socket as well. 36 | * @param {boolean} buffered - Whether the rendering of incoming data 37 | * should happen instantly or at a maximum 38 | * frequency of 1 rendering per 10ms. 39 | */ 40 | exports.attach = function (term, socket, bidirectional, buffered) { 41 | bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional; 42 | term.socket = socket; 43 | 44 | term._flushBuffer = function () { 45 | term.write(term._attachSocketBuffer); 46 | term._attachSocketBuffer = null; 47 | clearTimeout(term._attachSocketBufferTimer); 48 | term._attachSocketBufferTimer = null; 49 | }; 50 | 51 | term._pushToBuffer = function (data) { 52 | if (term._attachSocketBuffer) { 53 | term._attachSocketBuffer += data; 54 | } else { 55 | term._attachSocketBuffer = data; 56 | setTimeout(term._flushBuffer, 10); 57 | } 58 | }; 59 | 60 | term._getMessage = function (ev) { 61 | if (buffered) { 62 | term._pushToBuffer(ev.data); 63 | } else { 64 | term.write(ev.data); 65 | } 66 | }; 67 | 68 | term._sendData = function (data) { 69 | socket.send(data); 70 | }; 71 | 72 | socket.addEventListener('message', term._getMessage); 73 | 74 | if (bidirectional) { 75 | term.on('data', term._sendData); 76 | } 77 | 78 | socket.addEventListener('close', term.detach.bind(term, socket)); 79 | socket.addEventListener('error', term.detach.bind(term, socket)); 80 | }; 81 | 82 | /** 83 | * Detaches the given terminal from the given socket 84 | * 85 | * @param {Xterm} term - The terminal to be detached from the given socket. 86 | * @param {WebSocket} socket - The socket from which to detach the current 87 | * terminal. 88 | */ 89 | exports.detach = function (term, socket) { 90 | term.off('data', term._sendData); 91 | 92 | socket = (typeof socket == 'undefined') ? term.socket : socket; 93 | 94 | if (socket) { 95 | socket.removeEventListener('message', term._getMessage); 96 | } 97 | 98 | delete term.socket; 99 | }; 100 | 101 | /** 102 | * Attaches the current terminal to the given socket 103 | * 104 | * @param {WebSocket} socket - The socket to attach the current terminal. 105 | * @param {boolean} bidirectional - Whether the terminal should send data 106 | * to the socket as well. 107 | * @param {boolean} buffered - Whether the rendering of incoming data 108 | * should happen instantly or at a maximum 109 | * frequency of 1 rendering per 10ms. 110 | */ 111 | Xterm.prototype.attach = function (socket, bidirectional, buffered) { 112 | return exports.attach(this, socket, bidirectional, buffered); 113 | }; 114 | 115 | /** 116 | * Detaches the current terminal from the given socket. 117 | * 118 | * @param {WebSocket} socket - The socket from which to detach the current 119 | * terminal. 120 | */ 121 | Xterm.prototype.detach = function (socket) { 122 | return exports.detach(this, socket); 123 | }; 124 | 125 | return exports; 126 | }); 127 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/attach/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.attach", 3 | "main": "attach.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/fit/fit.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Fit terminal columns and rows to the dimensions of its DOM element. 3 | * 4 | * ## Approach 5 | * - Rows: Truncate the division of the terminal parent element height by the terminal row height. 6 | * 7 | * - Columns: Truncate the division of the terminal parent element width by the terminal character 8 | * width (apply display: inline at the terminal row and truncate its width with the current 9 | * number of columns). 10 | * @module xterm/addons/fit/fit 11 | * @license MIT 12 | */ 13 | 14 | (function (fit) { 15 | if (typeof exports === 'object' && typeof module === 'object') { 16 | /* 17 | * CommonJS environment 18 | */ 19 | module.exports = fit(require('../../xterm')); 20 | } else if (typeof define == 'function') { 21 | /* 22 | * Require.js is available 23 | */ 24 | define(['../../xterm'], fit); 25 | } else { 26 | /* 27 | * Plain browser environment 28 | */ 29 | fit(window.Terminal); 30 | } 31 | })(function (Xterm) { 32 | var exports = {}; 33 | 34 | exports.proposeGeometry = function (term) { 35 | if (!term.element.parentElement) { 36 | return null; 37 | } 38 | var parentElementStyle = window.getComputedStyle(term.element.parentElement), 39 | parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')), 40 | parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')) - 17), 41 | elementStyle = window.getComputedStyle(term.element), 42 | elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')), 43 | elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')), 44 | availableHeight = parentElementHeight - elementPaddingVer, 45 | availableWidth = parentElementWidth - elementPaddingHor, 46 | container = term.rowContainer, 47 | subjectRow = term.rowContainer.firstElementChild, 48 | contentBuffer = subjectRow.innerHTML, 49 | characterHeight, 50 | rows, 51 | characterWidth, 52 | cols, 53 | geometry; 54 | 55 | subjectRow.style.display = 'inline'; 56 | subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace 57 | characterWidth = subjectRow.getBoundingClientRect().width; 58 | subjectRow.style.display = ''; // Revert style before calculating height, since they differ. 59 | characterHeight = subjectRow.getBoundingClientRect().height; 60 | subjectRow.innerHTML = contentBuffer; 61 | 62 | rows = parseInt(availableHeight / characterHeight); 63 | cols = parseInt(availableWidth / characterWidth); 64 | 65 | geometry = {cols: cols, rows: rows}; 66 | return geometry; 67 | }; 68 | 69 | exports.fit = function (term) { 70 | var geometry = exports.proposeGeometry(term); 71 | 72 | if (geometry) { 73 | term.resize(geometry.cols, geometry.rows); 74 | } 75 | }; 76 | 77 | Xterm.prototype.proposeGeometry = function () { 78 | return exports.proposeGeometry(this); 79 | }; 80 | 81 | Xterm.prototype.fit = function () { 82 | return exports.fit(this); 83 | }; 84 | 85 | return exports; 86 | }); 87 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/fit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.fit", 3 | "main": "fit.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/fullscreen/fullscreen.css: -------------------------------------------------------------------------------- 1 | .xterm.fullscreen { 2 | position: fixed; 3 | top: 0; 4 | bottom: 0; 5 | left: 0; 6 | right: 0; 7 | width: auto; 8 | height: auto; 9 | z-index: 255; 10 | } 11 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/fullscreen/fullscreen.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Fullscreen addon for xterm.js 3 | * @module xterm/addons/fullscreen/fullscreen 4 | * @license MIT 5 | */ 6 | (function (fullscreen) { 7 | if (typeof exports === 'object' && typeof module === 'object') { 8 | /* 9 | * CommonJS environment 10 | */ 11 | module.exports = fullscreen(require('../../xterm')); 12 | } else if (typeof define == 'function') { 13 | /* 14 | * Require.js is available 15 | */ 16 | define(['../../xterm'], fullscreen); 17 | } else { 18 | /* 19 | * Plain browser environment 20 | */ 21 | fullscreen(window.Terminal); 22 | } 23 | })(function (Xterm) { 24 | var exports = {}; 25 | 26 | /** 27 | * Toggle the given terminal's fullscreen mode. 28 | * @param {Xterm} term - The terminal to toggle full screen mode 29 | * @param {boolean} fullscreen - Toggle fullscreen on (true) or off (false) 30 | */ 31 | exports.toggleFullScreen = function (term, fullscreen) { 32 | var fn; 33 | 34 | if (typeof fullscreen == 'undefined') { 35 | fn = (term.element.classList.contains('fullscreen')) ? 'remove' : 'add'; 36 | } else if (!fullscreen) { 37 | fn = 'remove'; 38 | } else { 39 | fn = 'add'; 40 | } 41 | 42 | term.element.classList[fn]('fullscreen'); 43 | }; 44 | 45 | Xterm.prototype.toggleFullscreen = function (fullscreen) { 46 | exports.toggleFullScreen(this, fullscreen); 47 | }; 48 | 49 | return exports; 50 | }); 51 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/fullscreen/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.fullscreen", 3 | "main": "fullscreen.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/terminado/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.terminado", 3 | "main": "terminado.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/dist/addons/terminado/terminado.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This module provides methods for attaching a terminal to a terminado WebSocket stream. 3 | * 4 | * @module xterm/addons/terminado/terminado 5 | * @license MIT 6 | */ 7 | 8 | (function (attach) { 9 | if (typeof exports === 'object' && typeof module === 'object') { 10 | /* 11 | * CommonJS environment 12 | */ 13 | module.exports = attach(require('../../xterm')); 14 | } else if (typeof define == 'function') { 15 | /* 16 | * Require.js is available 17 | */ 18 | define(['../../xterm'], attach); 19 | } else { 20 | /* 21 | * Plain browser environment 22 | */ 23 | attach(window.Terminal); 24 | } 25 | })(function (Xterm) { 26 | 'use strict'; 27 | 28 | var exports = {}; 29 | 30 | /** 31 | * Attaches the given terminal to the given socket. 32 | * 33 | * @param {Xterm} term - The terminal to be attached to the given socket. 34 | * @param {WebSocket} socket - The socket to attach the current terminal. 35 | * @param {boolean} bidirectional - Whether the terminal should send data 36 | * to the socket as well. 37 | * @param {boolean} buffered - Whether the rendering of incoming data 38 | * should happen instantly or at a maximum 39 | * frequency of 1 rendering per 10ms. 40 | */ 41 | exports.terminadoAttach = function (term, socket, bidirectional, buffered) { 42 | bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional; 43 | term.socket = socket; 44 | 45 | term._flushBuffer = function () { 46 | term.write(term._attachSocketBuffer); 47 | term._attachSocketBuffer = null; 48 | clearTimeout(term._attachSocketBufferTimer); 49 | term._attachSocketBufferTimer = null; 50 | }; 51 | 52 | term._pushToBuffer = function (data) { 53 | if (term._attachSocketBuffer) { 54 | term._attachSocketBuffer += data; 55 | } else { 56 | term._attachSocketBuffer = data; 57 | setTimeout(term._flushBuffer, 10); 58 | } 59 | }; 60 | 61 | term._getMessage = function (ev) { 62 | var data = JSON.parse(ev.data) 63 | if( data[0] == "stdout" ) { 64 | if (buffered) { 65 | term._pushToBuffer(data[1]); 66 | } else { 67 | term.write(data[1]); 68 | } 69 | } 70 | }; 71 | 72 | term._sendData = function (data) { 73 | socket.send(JSON.stringify(['stdin', data])); 74 | }; 75 | 76 | term._setSize = function (size) { 77 | socket.send(JSON.stringify(['set_size', size.rows, size.cols])); 78 | }; 79 | 80 | socket.addEventListener('message', term._getMessage); 81 | 82 | if (bidirectional) { 83 | term.on('data', term._sendData); 84 | } 85 | term.on('resize', term._setSize); 86 | 87 | socket.addEventListener('close', term.terminadoDetach.bind(term, socket)); 88 | socket.addEventListener('error', term.terminadoDetach.bind(term, socket)); 89 | }; 90 | 91 | /** 92 | * Detaches the given terminal from the given socket 93 | * 94 | * @param {Xterm} term - The terminal to be detached from the given socket. 95 | * @param {WebSocket} socket - The socket from which to detach the current 96 | * terminal. 97 | */ 98 | exports.terminadoDetach = function (term, socket) { 99 | term.off('data', term._sendData); 100 | 101 | socket = (typeof socket == 'undefined') ? term.socket : socket; 102 | 103 | if (socket) { 104 | socket.removeEventListener('message', term._getMessage); 105 | } 106 | 107 | delete term.socket; 108 | }; 109 | 110 | /** 111 | * Attaches the current terminal to the given socket 112 | * 113 | * @param {WebSocket} socket - The socket to attach the current terminal. 114 | * @param {boolean} bidirectional - Whether the terminal should send data 115 | * to the socket as well. 116 | * @param {boolean} buffered - Whether the rendering of incoming data 117 | * should happen instantly or at a maximum 118 | * frequency of 1 rendering per 10ms. 119 | */ 120 | Xterm.prototype.terminadoAttach = function (socket, bidirectional, buffered) { 121 | return exports.terminadoAttach(this, socket, bidirectional, buffered); 122 | }; 123 | 124 | /** 125 | * Detaches the current terminal from the given socket. 126 | * 127 | * @param {WebSocket} socket - The socket from which to detach the current 128 | * terminal. 129 | */ 130 | Xterm.prototype.terminadoDetach = function (socket) { 131 | return exports.terminadoDetach(this, socket); 132 | }; 133 | 134 | return exports; 135 | }); 136 | -------------------------------------------------------------------------------- /static/xterm/jsdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "source": { 3 | "include": [ 4 | "src/" 5 | ], 6 | "exclude": [ 7 | "src/test/" 8 | ], 9 | "excludePattern": "src/.+\\.test\\.(js|ts)$" 10 | }, 11 | "opts": { 12 | "readme": "README.md", 13 | "template": "node_modules/docdash", 14 | "encoding": "utf8", 15 | "destination": "docs/", 16 | "recurse": true, 17 | "verbose": true 18 | }, 19 | "plugins": [ 20 | "plugins/markdown" 21 | ], 22 | "templates": { 23 | "cleverLinks": false, 24 | "monospaceLinks": false 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /static/xterm/lib/Buffer.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var CircularList_1 = require("./utils/CircularList"); 4 | var Buffer = (function () { 5 | function Buffer(_terminal) { 6 | this._terminal = _terminal; 7 | this.clear(); 8 | } 9 | Object.defineProperty(Buffer.prototype, "lines", { 10 | get: function () { 11 | return this._lines; 12 | }, 13 | enumerable: true, 14 | configurable: true 15 | }); 16 | Buffer.prototype.fillViewportRows = function () { 17 | if (this._lines.length === 0) { 18 | var i = this._terminal.rows; 19 | while (i--) { 20 | this.lines.push(this._terminal.blankLine()); 21 | } 22 | } 23 | }; 24 | Buffer.prototype.clear = function () { 25 | this.ydisp = 0; 26 | this.ybase = 0; 27 | this.y = 0; 28 | this.x = 0; 29 | this.scrollBottom = 0; 30 | this.scrollTop = 0; 31 | this.tabs = {}; 32 | this._lines = new CircularList_1.CircularList(this._terminal.scrollback); 33 | this.scrollBottom = this._terminal.rows - 1; 34 | }; 35 | Buffer.prototype.resize = function (newCols, newRows) { 36 | if (this._lines.length === 0) { 37 | return; 38 | } 39 | if (this._terminal.cols < newCols) { 40 | var ch = [this._terminal.defAttr, ' ', 1]; 41 | for (var i = 0; i < this._lines.length; i++) { 42 | if (this._lines.get(i) === undefined) { 43 | this._lines.set(i, this._terminal.blankLine(undefined, undefined, newCols)); 44 | } 45 | while (this._lines.get(i).length < newCols) { 46 | this._lines.get(i).push(ch); 47 | } 48 | } 49 | } 50 | var addToY = 0; 51 | if (this._terminal.rows < newRows) { 52 | for (var y = this._terminal.rows; y < newRows; y++) { 53 | if (this._lines.length < newRows + this.ybase) { 54 | if (this.ybase > 0 && this._lines.length <= this.ybase + this.y + addToY + 1) { 55 | this.ybase--; 56 | addToY++; 57 | if (this.ydisp > 0) { 58 | this.ydisp--; 59 | } 60 | } 61 | else { 62 | this._lines.push(this._terminal.blankLine(undefined, undefined, newCols)); 63 | } 64 | } 65 | } 66 | } 67 | else { 68 | for (var y = this._terminal.rows; y > newRows; y--) { 69 | if (this._lines.length > newRows + this.ybase) { 70 | if (this._lines.length > this.ybase + this.y + 1) { 71 | this._lines.pop(); 72 | } 73 | else { 74 | this.ybase++; 75 | this.ydisp++; 76 | } 77 | } 78 | } 79 | } 80 | if (this.y >= newRows) { 81 | this.y = newRows - 1; 82 | } 83 | if (addToY) { 84 | this.y += addToY; 85 | } 86 | if (this.x >= newCols) { 87 | this.x = newCols - 1; 88 | } 89 | this.scrollTop = 0; 90 | this.scrollBottom = newRows - 1; 91 | }; 92 | return Buffer; 93 | }()); 94 | exports.Buffer = Buffer; 95 | 96 | //# sourceMappingURL=Buffer.js.map 97 | -------------------------------------------------------------------------------- /static/xterm/lib/Buffer.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/Buffer.ts"],"names":[],"mappings":";;AAKA,qDAAoD;AASpD;IAqBE,gBACU,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;QAE5B,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,sBAAW,yBAAK;aAAhB;YACE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAKM,iCAAgB,GAAvB;QACE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAC5B,OAAO,CAAC,EAAE,EAAE,CAAC;gBACX,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;IAKM,sBAAK,GAAZ;QACE,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QAC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EjD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;oBACpB,CAAC;oBAAC,IAAI,CAAC,CAAC;wBAEN,IAAI,CAAC,KAAK,EAAE,CAAC;wBACb,IAAI,CAAC,KAAK,EAAE,CAAC;oBACf,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAGD,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACX,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC;QACnB,CAAC;QAED,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;QACvB,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,OAAO,GAAG,CAAC,CAAC;IAClC,CAAC;IACH,aAAC;AAAD,CAvIA,AAuIC,IAAA;AAvIY,wBAAM","file":"Buffer.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/BufferSet.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 | return function (d, b) { 7 | extendStatics(d, b); 8 | function __() { this.constructor = d; } 9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10 | }; 11 | })(); 12 | Object.defineProperty(exports, "__esModule", { value: true }); 13 | var Buffer_1 = require("./Buffer"); 14 | var EventEmitter_1 = require("./EventEmitter"); 15 | var BufferSet = (function (_super) { 16 | __extends(BufferSet, _super); 17 | function BufferSet(_terminal) { 18 | var _this = _super.call(this) || this; 19 | _this._terminal = _terminal; 20 | _this._normal = new Buffer_1.Buffer(_this._terminal); 21 | _this._normal.fillViewportRows(); 22 | _this._alt = new Buffer_1.Buffer(_this._terminal); 23 | _this._activeBuffer = _this._normal; 24 | return _this; 25 | } 26 | Object.defineProperty(BufferSet.prototype, "alt", { 27 | get: function () { 28 | return this._alt; 29 | }, 30 | enumerable: true, 31 | configurable: true 32 | }); 33 | Object.defineProperty(BufferSet.prototype, "active", { 34 | get: function () { 35 | return this._activeBuffer; 36 | }, 37 | enumerable: true, 38 | configurable: true 39 | }); 40 | Object.defineProperty(BufferSet.prototype, "normal", { 41 | get: function () { 42 | return this._normal; 43 | }, 44 | enumerable: true, 45 | configurable: true 46 | }); 47 | BufferSet.prototype.activateNormalBuffer = function () { 48 | this._alt.clear(); 49 | this._activeBuffer = this._normal; 50 | this.emit('activate', this._normal); 51 | }; 52 | BufferSet.prototype.activateAltBuffer = function () { 53 | this._alt.fillViewportRows(); 54 | this._activeBuffer = this._alt; 55 | this.emit('activate', this._alt); 56 | }; 57 | BufferSet.prototype.resize = function (newCols, newRows) { 58 | this._normal.resize(newCols, newRows); 59 | this._alt.resize(newCols, newRows); 60 | }; 61 | return BufferSet; 62 | }(EventEmitter_1.EventEmitter)); 63 | exports.BufferSet = BufferSet; 64 | 65 | //# sourceMappingURL=BufferSet.js.map 66 | -------------------------------------------------------------------------------- /static/xterm/lib/BufferSet.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/BufferSet.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,mCAAkC;AAClC,+CAA8C;AAM9C;IAA+B,6BAAY;IASzC,mBAAoB,SAAoB;QAAxC,YACE,iBAAO,SAKR;QANmB,eAAS,GAAT,SAAS,CAAW;QAEtC,KAAI,CAAC,OAAO,GAAG,IAAI,eAAM,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,KAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAChC,KAAI,CAAC,IAAI,GAAG,IAAI,eAAM,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;QACvC,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,OAAO,CAAC;;IACpC,CAAC;IAMD,sBAAW,0BAAG;aAAd;YACE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;;;OAAA;IAMD,sBAAW,6BAAM;aAAjB;YACE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;;;OAAA;IAMD,sBAAW,6BAAM;aAAjB;YACE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;;;OAAA;IAKM,wCAAoB,GAA3B;QAIE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAElB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAKM,qCAAiB,GAAxB;QAGE,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAE7B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAOM,0BAAM,GAAb,UAAc,OAAe,EAAE,OAAe;QAC5C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IACH,gBAAC;AAAD,CA3EA,AA2EC,CA3E8B,2BAAY,GA2E1C;AA3EY,8BAAS","file":"BufferSet.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/BufferSet.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var chai_1 = require("chai"); 4 | var BufferSet_1 = require("./BufferSet"); 5 | var Buffer_1 = require("./Buffer"); 6 | var TestUtils_1 = require("./utils/TestUtils"); 7 | describe('BufferSet', function () { 8 | var terminal; 9 | var bufferSet; 10 | beforeEach(function () { 11 | terminal = new TestUtils_1.MockTerminal(); 12 | terminal.cols = 80; 13 | terminal.rows = 24; 14 | terminal.scrollback = 1000; 15 | bufferSet = new BufferSet_1.BufferSet(terminal); 16 | }); 17 | describe('constructor', function () { 18 | it('should create two different buffers: alt and normal', function () { 19 | chai_1.assert.instanceOf(bufferSet.normal, Buffer_1.Buffer); 20 | chai_1.assert.instanceOf(bufferSet.alt, Buffer_1.Buffer); 21 | chai_1.assert.notEqual(bufferSet.normal, bufferSet.alt); 22 | }); 23 | }); 24 | describe('activateNormalBuffer', function () { 25 | beforeEach(function () { 26 | bufferSet.activateNormalBuffer(); 27 | }); 28 | it('should set the normal buffer as the currently active buffer', function () { 29 | chai_1.assert.equal(bufferSet.active, bufferSet.normal); 30 | }); 31 | }); 32 | describe('activateAltBuffer', function () { 33 | beforeEach(function () { 34 | bufferSet.activateAltBuffer(); 35 | }); 36 | it('should set the alt buffer as the currently active buffer', function () { 37 | chai_1.assert.equal(bufferSet.active, bufferSet.alt); 38 | }); 39 | }); 40 | }); 41 | 42 | //# sourceMappingURL=BufferSet.test.js.map 43 | -------------------------------------------------------------------------------- /static/xterm/lib/BufferSet.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/BufferSet.test.ts"],"names":[],"mappings":";;AAGA,6BAA8B;AAE9B,yCAAwC;AACxC,mCAAkC;AAClC,+CAAiD;AAEjD,QAAQ,CAAC,WAAW,EAAE;IACpB,IAAI,QAAmB,CAAC;IACxB,IAAI,SAAoB,CAAC;IAEzB,UAAU,CAAC;QACT,QAAQ,GAAG,IAAI,wBAAY,EAAE,CAAC;QAC9B,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC;QACnB,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC;QACnB,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;QAC3B,SAAS,GAAG,IAAI,qBAAS,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE;QACtB,EAAE,CAAC,qDAAqD,EAAE;YACxD,aAAM,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,eAAM,CAAC,CAAC;YAC5C,aAAM,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,eAAM,CAAC,CAAC;YACzC,aAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE;QAC/B,UAAU,CAAC;YACT,SAAS,CAAC,oBAAoB,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6DAA6D,EAAE;YAChE,aAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,mBAAmB,EAAE;QAC5B,UAAU,CAAC;YACT,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE;YAC7D,aAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"BufferSet.test.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/Charsets.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.CHARSETS = {}; 4 | exports.DEFAULT_CHARSET = exports.CHARSETS['B']; 5 | exports.CHARSETS['0'] = { 6 | '`': '\u25c6', 7 | 'a': '\u2592', 8 | 'b': '\u0009', 9 | 'c': '\u000c', 10 | 'd': '\u000d', 11 | 'e': '\u000a', 12 | 'f': '\u00b0', 13 | 'g': '\u00b1', 14 | 'h': '\u2424', 15 | 'i': '\u000b', 16 | 'j': '\u2518', 17 | 'k': '\u2510', 18 | 'l': '\u250c', 19 | 'm': '\u2514', 20 | 'n': '\u253c', 21 | 'o': '\u23ba', 22 | 'p': '\u23bb', 23 | 'q': '\u2500', 24 | 'r': '\u23bc', 25 | 's': '\u23bd', 26 | 't': '\u251c', 27 | 'u': '\u2524', 28 | 'v': '\u2534', 29 | 'w': '\u252c', 30 | 'x': '\u2502', 31 | 'y': '\u2264', 32 | 'z': '\u2265', 33 | '{': '\u03c0', 34 | '|': '\u2260', 35 | '}': '\u00a3', 36 | '~': '\u00b7' 37 | }; 38 | exports.CHARSETS['A'] = { 39 | '#': '£' 40 | }; 41 | exports.CHARSETS['B'] = null; 42 | exports.CHARSETS['4'] = { 43 | '#': '£', 44 | '@': '¾', 45 | '[': 'ij', 46 | '\\': '½', 47 | ']': '|', 48 | '{': '¨', 49 | '|': 'f', 50 | '}': '¼', 51 | '~': '´' 52 | }; 53 | exports.CHARSETS['C'] = 54 | exports.CHARSETS['5'] = { 55 | '[': 'Ä', 56 | '\\': 'Ö', 57 | ']': 'Å', 58 | '^': 'Ü', 59 | '`': 'é', 60 | '{': 'ä', 61 | '|': 'ö', 62 | '}': 'å', 63 | '~': 'ü' 64 | }; 65 | exports.CHARSETS['R'] = { 66 | '#': '£', 67 | '@': 'à', 68 | '[': '°', 69 | '\\': 'ç', 70 | ']': '§', 71 | '{': 'é', 72 | '|': 'ù', 73 | '}': 'è', 74 | '~': '¨' 75 | }; 76 | exports.CHARSETS['Q'] = { 77 | '@': 'à', 78 | '[': 'â', 79 | '\\': 'ç', 80 | ']': 'ê', 81 | '^': 'î', 82 | '`': 'ô', 83 | '{': 'é', 84 | '|': 'ù', 85 | '}': 'è', 86 | '~': 'û' 87 | }; 88 | exports.CHARSETS['K'] = { 89 | '@': '§', 90 | '[': 'Ä', 91 | '\\': 'Ö', 92 | ']': 'Ü', 93 | '{': 'ä', 94 | '|': 'ö', 95 | '}': 'ü', 96 | '~': 'ß' 97 | }; 98 | exports.CHARSETS['Y'] = { 99 | '#': '£', 100 | '@': '§', 101 | '[': '°', 102 | '\\': 'ç', 103 | ']': 'é', 104 | '`': 'ù', 105 | '{': 'à', 106 | '|': 'ò', 107 | '}': 'è', 108 | '~': 'ì' 109 | }; 110 | exports.CHARSETS['E'] = 111 | exports.CHARSETS['6'] = { 112 | '@': 'Ä', 113 | '[': 'Æ', 114 | '\\': 'Ø', 115 | ']': 'Å', 116 | '^': 'Ü', 117 | '`': 'ä', 118 | '{': 'æ', 119 | '|': 'ø', 120 | '}': 'å', 121 | '~': 'ü' 122 | }; 123 | exports.CHARSETS['Z'] = { 124 | '#': '£', 125 | '@': '§', 126 | '[': '¡', 127 | '\\': 'Ñ', 128 | ']': '¿', 129 | '{': '°', 130 | '|': 'ñ', 131 | '}': 'ç' 132 | }; 133 | exports.CHARSETS['H'] = 134 | exports.CHARSETS['7'] = { 135 | '@': 'É', 136 | '[': 'Ä', 137 | '\\': 'Ö', 138 | ']': 'Å', 139 | '^': 'Ü', 140 | '`': 'é', 141 | '{': 'ä', 142 | '|': 'ö', 143 | '}': 'å', 144 | '~': 'ü' 145 | }; 146 | exports.CHARSETS['='] = { 147 | '#': 'ù', 148 | '@': 'à', 149 | '[': 'é', 150 | '\\': 'ç', 151 | ']': 'ê', 152 | '^': 'î', 153 | '_': 'è', 154 | '`': 'ô', 155 | '{': 'ä', 156 | '|': 'ö', 157 | '}': 'ü', 158 | '~': 'û' 159 | }; 160 | 161 | //# sourceMappingURL=Charsets.js.map 162 | -------------------------------------------------------------------------------- /static/xterm/lib/Charsets.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/Charsets.ts"],"names":[],"mappings":";;AASa,QAAA,QAAQ,GAA6C,EAAE,CAAC;AAKxD,QAAA,eAAe,GAAG,gBAAQ,CAAC,GAAG,CAAC,CAAC;AAY7C,gBAAQ,CAAC,GAAG,CAAC,GAAG;IACd,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;CACd,CAAC;AAOF,gBAAQ,CAAC,GAAG,CAAC,GAAG;IACd,GAAG,EAAE,GAAG;CACT,CAAC;AAMF,gBAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAOrB,gBAAQ,CAAC,GAAG,CAAC,GAAG;IACd,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,GAAG;IACT,GAAG,EAAE,GAA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,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;CACT,CAAC","file":"Charsets.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/CompositionHelper.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/CompositionHelper.ts"],"names":[],"mappings":";;AAgBA;IAwBE,2BACU,QAA6B,EAC7B,eAA4B,EAC5B,QAAmB;QAFnB,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,oBAAe,GAAf,eAAe,CAAa;QAC5B,aAAQ,GAAR,QAAQ,CAAW;QAE3B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,mBAAmB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;IAKM,4CAAgB,GAAvB;QACE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,mBAAmB,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAC5D,IAAI,CAAC,eAAe,CAAC,WAAW,GAAG,EAAE,CAAC;QACtC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAMM,6CAAiB,GAAxB,UAAyB,EAAoB;QAA7C,iBAMC;QALC,IAAI,CAAC,eAAe,CAAC,WAAW,GAAG,EAAE,CAAC,IAAI,CAAC;QAC3C,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,UAAU,CAAC;YACT,KAAI,CAAC,mBAAmB,CAAC,GAAG,GAAG,KAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAC5D,CAAC,EAAE,CAAC,CAAC,CAAC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AG,IAAI,CAAC;YACpD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC;YAC3C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG,qBAAqB,CAAC,KAAK,GAAG,IAAI,CAAC;YAC/D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,GAAG,IAAI,CAAC;YACjE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,GAAG,qBAAqB,CAAC,MAAM,GAAG,IAAI,CAAC;QACvE,CAAC;QACD,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;YACjB,UAAU,CAAC,cAAM,OAAA,KAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAApC,CAAoC,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAAA,CAAC;IAMM,iDAAqB,GAA7B;QACE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;IAC/B,CAAC;IAAA,CAAC;IACJ,wBAAC;AAAD,CApNA,AAoNC,IAAA;AApNY,8CAAiB","file":"CompositionHelper.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/EscapeSequences.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var C0; 4 | (function (C0) { 5 | C0.NUL = '\x00'; 6 | C0.SOH = '\x01'; 7 | C0.STX = '\x02'; 8 | C0.ETX = '\x03'; 9 | C0.EOT = '\x04'; 10 | C0.ENQ = '\x05'; 11 | C0.ACK = '\x06'; 12 | C0.BEL = '\x07'; 13 | C0.BS = '\x08'; 14 | C0.HT = '\x09'; 15 | C0.LF = '\x0a'; 16 | C0.VT = '\x0b'; 17 | C0.FF = '\x0c'; 18 | C0.CR = '\x0d'; 19 | C0.SO = '\x0e'; 20 | C0.SI = '\x0f'; 21 | C0.DLE = '\x10'; 22 | C0.DC1 = '\x11'; 23 | C0.DC2 = '\x12'; 24 | C0.DC3 = '\x13'; 25 | C0.DC4 = '\x14'; 26 | C0.NAK = '\x15'; 27 | C0.SYN = '\x16'; 28 | C0.ETB = '\x17'; 29 | C0.CAN = '\x18'; 30 | C0.EM = '\x19'; 31 | C0.SUB = '\x1a'; 32 | C0.ESC = '\x1b'; 33 | C0.FS = '\x1c'; 34 | C0.GS = '\x1d'; 35 | C0.RS = '\x1e'; 36 | C0.US = '\x1f'; 37 | C0.SP = '\x20'; 38 | C0.DEL = '\x7f'; 39 | })(C0 = exports.C0 || (exports.C0 = {})); 40 | ; 41 | 42 | //# sourceMappingURL=EscapeSequences.js.map 43 | -------------------------------------------------------------------------------- /static/xterm/lib/EscapeSequences.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/EscapeSequences.ts"],"names":[],"mappings":";;AAQA,IAAiB,EAAE,CAqElB;AArED,WAAiB,EAAE;IAEJ,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,KAAE,GAAI,MAAM,CAAC;IAEb,MAAG,GAAG,MAAM,CAAC;AAC5B,CAAC,EArEgB,EAAE,GAAF,UAAE,KAAF,UAAE,QAqElB;AAAA,CAAC","file":"EscapeSequences.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/EventEmitter.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | ; 4 | var EventEmitter = (function () { 5 | function EventEmitter() { 6 | this._events = this._events || {}; 7 | } 8 | EventEmitter.prototype.on = function (type, listener) { 9 | this._events[type] = this._events[type] || []; 10 | this._events[type].push(listener); 11 | }; 12 | EventEmitter.prototype.off = function (type, listener) { 13 | if (!this._events[type]) { 14 | return; 15 | } 16 | var obj = this._events[type]; 17 | var i = obj.length; 18 | while (i--) { 19 | if (obj[i] === listener || obj[i].listener === listener) { 20 | obj.splice(i, 1); 21 | return; 22 | } 23 | } 24 | }; 25 | EventEmitter.prototype.removeAllListeners = function (type) { 26 | if (this._events[type]) { 27 | delete this._events[type]; 28 | } 29 | }; 30 | EventEmitter.prototype.once = function (type, listener) { 31 | function on() { 32 | var args = Array.prototype.slice.call(arguments); 33 | this.off(type, on); 34 | return listener.apply(this, args); 35 | } 36 | on.listener = listener; 37 | return this.on(type, on); 38 | }; 39 | EventEmitter.prototype.emit = function (type) { 40 | var args = []; 41 | for (var _i = 1; _i < arguments.length; _i++) { 42 | args[_i - 1] = arguments[_i]; 43 | } 44 | if (!this._events[type]) { 45 | return; 46 | } 47 | var obj = this._events[type]; 48 | for (var i = 0; i < obj.length; i++) { 49 | obj[i].apply(this, args); 50 | } 51 | }; 52 | EventEmitter.prototype.listeners = function (type) { 53 | return this._events[type] || []; 54 | }; 55 | return EventEmitter; 56 | }()); 57 | exports.EventEmitter = EventEmitter; 58 | 59 | //# sourceMappingURL=EventEmitter.js.map 60 | -------------------------------------------------------------------------------- /static/xterm/lib/EventEmitter.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/EventEmitter.ts"],"names":[],"mappings":";;AASC,CAAC;AAEF;IAGE;QAGE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;IACpC,CAAC;IAEM,yBAAE,GAAT,UAAU,IAAI,EAAE,QAAQ;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAEM,0BAAG,GAAV,UAAW,IAAI,EAAE,QAAQ;QACvB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACxB,MAAM,CAAC;QACT,CAAC;QAED,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;QAEnB,OAAO,CAAC,EAAE,EAAE,CAAC;YACX,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,C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AS,GAAhB,UAAiB,IAAI;QACnB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAClC,CAAC;IACH,mBAAC;AAAD,CA3DA,AA2DC,IAAA;AA3DY,oCAAY","file":"EventEmitter.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/EventEmitter.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var chai_1 = require("chai"); 4 | var EventEmitter_1 = require("./EventEmitter"); 5 | describe('EventEmitter', function () { 6 | var eventEmitter; 7 | beforeEach(function () { 8 | eventEmitter = new EventEmitter_1.EventEmitter(); 9 | }); 10 | describe('once', function () { 11 | it('should trigger the listener only once', function () { 12 | var count = 0; 13 | var listener = function () { return count++; }; 14 | eventEmitter.once('test', listener); 15 | eventEmitter.emit('test'); 16 | chai_1.assert.equal(count, 1); 17 | eventEmitter.emit('test'); 18 | chai_1.assert.equal(count, 1); 19 | }); 20 | }); 21 | describe('emit', function () { 22 | it('should emit events to listeners', function () { 23 | var count1 = 0; 24 | var count2 = 0; 25 | var listener1 = function () { return count1++; }; 26 | var listener2 = function () { return count2++; }; 27 | eventEmitter.on('test', listener1); 28 | eventEmitter.on('test', listener2); 29 | eventEmitter.emit('test'); 30 | chai_1.assert.equal(count1, 1); 31 | chai_1.assert.equal(count2, 1); 32 | eventEmitter.emit('test'); 33 | chai_1.assert.equal(count1, 2); 34 | chai_1.assert.equal(count2, 2); 35 | }); 36 | it('should manage multiple listener types', function () { 37 | var count1 = 0; 38 | var count2 = 0; 39 | var listener1 = function () { return count1++; }; 40 | var listener2 = function () { return count2++; }; 41 | eventEmitter.on('test', listener1); 42 | eventEmitter.on('foo', listener2); 43 | eventEmitter.emit('test'); 44 | chai_1.assert.equal(count1, 1); 45 | chai_1.assert.equal(count2, 0); 46 | eventEmitter.emit('foo'); 47 | chai_1.assert.equal(count1, 1); 48 | chai_1.assert.equal(count2, 1); 49 | }); 50 | }); 51 | describe('listeners', function () { 52 | it('should return listeners for the type requested', function () { 53 | chai_1.assert.equal(eventEmitter.listeners('test').length, 0); 54 | var listener = function () { }; 55 | eventEmitter.on('test', listener); 56 | chai_1.assert.deepEqual(eventEmitter.listeners('test'), [listener]); 57 | }); 58 | }); 59 | describe('off', function () { 60 | it('should remove the specific listener', function () { 61 | var listener1 = function () { }; 62 | var listener2 = function () { }; 63 | eventEmitter.on('foo', listener1); 64 | eventEmitter.on('foo', listener2); 65 | chai_1.assert.equal(eventEmitter.listeners('foo').length, 2); 66 | eventEmitter.off('foo', listener1); 67 | chai_1.assert.deepEqual(eventEmitter.listeners('foo'), [listener2]); 68 | }); 69 | }); 70 | describe('removeAllListeners', function () { 71 | it('should clear all listeners', function () { 72 | eventEmitter.on('foo', function () { }); 73 | chai_1.assert.equal(eventEmitter.listeners('foo').length, 1); 74 | eventEmitter.removeAllListeners('foo'); 75 | chai_1.assert.equal(eventEmitter.listeners('foo').length, 0); 76 | }); 77 | }); 78 | }); 79 | 80 | //# sourceMappingURL=EventEmitter.test.js.map 81 | -------------------------------------------------------------------------------- /static/xterm/lib/EventEmitter.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/EventEmitter.test.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAC9B,+CAA8C;AAE9C,QAAQ,CAAC,cAAc,EAAE;IACvB,IAAI,YAA0B,CAAC;IAE/B,UAAU,CAAC;QACT,YAAY,GAAG,IAAI,2BAAY,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,EAAE;QACf,EAAE,CAAC,uCAAuC,EAAE;YAC1C,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,IAAM,QAAQ,GAAG,cAAM,OAAA,KAAK,EAAE,EAAP,CAAO,CAAC;YAC/B,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACpC,YAAY,CAAC,IAAI,CAAC,MAAM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AAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YACtD,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACnC,aAAM,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,oBAAoB,EAAE;QAC7B,EAAE,CAAC,4BAA4B,EAAE;YAC/B,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,cAAO,CAAC,CAAC,CAAC;YACjC,aAAM,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YACtD,YAAY,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACvC,aAAM,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"EventEmitter.test.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/Interfaces.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | 4 | //# sourceMappingURL=Interfaces.js.map 5 | -------------------------------------------------------------------------------- /static/xterm/lib/Interfaces.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"Interfaces.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/SelectionModel.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var SelectionModel = (function () { 4 | function SelectionModel(_terminal) { 5 | this._terminal = _terminal; 6 | this.clearSelection(); 7 | } 8 | SelectionModel.prototype.clearSelection = function () { 9 | this.selectionStart = null; 10 | this.selectionEnd = null; 11 | this.isSelectAllActive = false; 12 | this.selectionStartLength = 0; 13 | }; 14 | Object.defineProperty(SelectionModel.prototype, "finalSelectionStart", { 15 | get: function () { 16 | if (this.isSelectAllActive) { 17 | return [0, 0]; 18 | } 19 | if (!this.selectionEnd || !this.selectionStart) { 20 | return this.selectionStart; 21 | } 22 | return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart; 23 | }, 24 | enumerable: true, 25 | configurable: true 26 | }); 27 | Object.defineProperty(SelectionModel.prototype, "finalSelectionEnd", { 28 | get: function () { 29 | if (this.isSelectAllActive) { 30 | return [this._terminal.cols, this._terminal.buffer.ybase + this._terminal.rows - 1]; 31 | } 32 | if (!this.selectionStart) { 33 | return null; 34 | } 35 | if (!this.selectionEnd || this.areSelectionValuesReversed()) { 36 | return [this.selectionStart[0] + this.selectionStartLength, this.selectionStart[1]]; 37 | } 38 | if (this.selectionStartLength) { 39 | if (this.selectionEnd[1] === this.selectionStart[1]) { 40 | return [Math.max(this.selectionStart[0] + this.selectionStartLength, this.selectionEnd[0]), this.selectionEnd[1]]; 41 | } 42 | } 43 | return this.selectionEnd; 44 | }, 45 | enumerable: true, 46 | configurable: true 47 | }); 48 | SelectionModel.prototype.areSelectionValuesReversed = function () { 49 | var start = this.selectionStart; 50 | var end = this.selectionEnd; 51 | return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]); 52 | }; 53 | SelectionModel.prototype.onTrim = function (amount) { 54 | if (this.selectionStart) { 55 | this.selectionStart[1] -= amount; 56 | } 57 | if (this.selectionEnd) { 58 | this.selectionEnd[1] -= amount; 59 | } 60 | if (this.selectionEnd && this.selectionEnd[1] < 0) { 61 | this.clearSelection(); 62 | return true; 63 | } 64 | if (this.selectionStart && this.selectionStart[1] < 0) { 65 | this.selectionStart[1] = 0; 66 | } 67 | return false; 68 | }; 69 | return SelectionModel; 70 | }()); 71 | exports.SelectionModel = SelectionModel; 72 | 73 | //# sourceMappingURL=SelectionModel.js.map 74 | -------------------------------------------------------------------------------- /static/xterm/lib/SelectionModel.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/SelectionModel.ts"],"names":[],"mappings":";;AAUA;IAuBE,wBACU,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;QAE5B,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAKM,uCAAc,GAArB;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC;IAChC,CAAC;IAKD,sBAAW,+CAAmB;aAA9B;YACE,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;gBAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAChB,CAAC;YAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;gBAC/C,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;YAC7B,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC;QACrF,CAAC;;;OAAA;IAMD,sBAAW,6CAAiB;aAA5B;YACE,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;gBAC3B,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;YACtF,CAAC;YAED,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;gBACzB,MAAM,CAAC,IAAI,CAA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I,MAAM,CAAC;QACnC,CAAC;QACD,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;QACjC,CAAC;QAGD,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC;QACd,CAAC;QAGD,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACtD,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IACH,qBAAC;AAAD,CArHA,AAqHC,IAAA;AArHY,wCAAc","file":"SelectionModel.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/Types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | 4 | //# sourceMappingURL=Types.js.map 5 | -------------------------------------------------------------------------------- /static/xterm/lib/Types.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"Types.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/Viewport.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var Viewport = (function () { 4 | function Viewport(terminal, viewportElement, scrollArea, charMeasure) { 5 | var _this = this; 6 | this.terminal = terminal; 7 | this.viewportElement = viewportElement; 8 | this.scrollArea = scrollArea; 9 | this.charMeasure = charMeasure; 10 | this.currentRowHeight = 0; 11 | this.lastRecordedBufferLength = 0; 12 | this.lastRecordedViewportHeight = 0; 13 | this.terminal.on('scroll', this.syncScrollArea.bind(this)); 14 | this.terminal.on('resize', this.syncScrollArea.bind(this)); 15 | this.viewportElement.addEventListener('scroll', this.onScroll.bind(this)); 16 | setTimeout(function () { return _this.syncScrollArea(); }, 0); 17 | } 18 | Viewport.prototype.refresh = function () { 19 | if (this.charMeasure.height > 0) { 20 | var rowHeightChanged = this.charMeasure.height !== this.currentRowHeight; 21 | if (rowHeightChanged) { 22 | this.currentRowHeight = this.charMeasure.height; 23 | this.viewportElement.style.lineHeight = this.charMeasure.height + 'px'; 24 | this.terminal.rowContainer.style.lineHeight = this.charMeasure.height + 'px'; 25 | } 26 | var viewportHeightChanged = this.lastRecordedViewportHeight !== this.terminal.rows; 27 | if (rowHeightChanged || viewportHeightChanged) { 28 | this.lastRecordedViewportHeight = this.terminal.rows; 29 | this.viewportElement.style.height = this.charMeasure.height * this.terminal.rows + 'px'; 30 | this.terminal.selectionContainer.style.height = this.viewportElement.style.height; 31 | } 32 | this.scrollArea.style.height = (this.charMeasure.height * this.lastRecordedBufferLength) + 'px'; 33 | } 34 | }; 35 | Viewport.prototype.syncScrollArea = function () { 36 | if (this.lastRecordedBufferLength !== this.terminal.buffer.lines.length) { 37 | this.lastRecordedBufferLength = this.terminal.buffer.lines.length; 38 | this.refresh(); 39 | } 40 | else if (this.lastRecordedViewportHeight !== this.terminal.rows) { 41 | this.refresh(); 42 | } 43 | else { 44 | if (this.charMeasure.height !== this.currentRowHeight) { 45 | this.refresh(); 46 | } 47 | } 48 | var scrollTop = this.terminal.buffer.ydisp * this.currentRowHeight; 49 | if (this.viewportElement.scrollTop !== scrollTop) { 50 | this.viewportElement.scrollTop = scrollTop; 51 | } 52 | }; 53 | Viewport.prototype.onScroll = function (ev) { 54 | var newRow = Math.round(this.viewportElement.scrollTop / this.currentRowHeight); 55 | var diff = newRow - this.terminal.buffer.ydisp; 56 | this.terminal.scrollDisp(diff, true); 57 | }; 58 | Viewport.prototype.onWheel = function (ev) { 59 | if (ev.deltaY === 0) { 60 | return; 61 | } 62 | var multiplier = 1; 63 | if (ev.deltaMode === WheelEvent.DOM_DELTA_LINE) { 64 | multiplier = this.currentRowHeight; 65 | } 66 | else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) { 67 | multiplier = this.currentRowHeight * this.terminal.rows; 68 | } 69 | this.viewportElement.scrollTop += ev.deltaY * multiplier; 70 | ev.preventDefault(); 71 | }; 72 | ; 73 | Viewport.prototype.onTouchStart = function (ev) { 74 | this.lastTouchY = ev.touches[0].pageY; 75 | }; 76 | ; 77 | Viewport.prototype.onTouchMove = function (ev) { 78 | var deltaY = this.lastTouchY - ev.touches[0].pageY; 79 | this.lastTouchY = ev.touches[0].pageY; 80 | if (deltaY === 0) { 81 | return; 82 | } 83 | this.viewportElement.scrollTop += deltaY; 84 | ev.preventDefault(); 85 | }; 86 | ; 87 | return Viewport; 88 | }()); 89 | exports.Viewport = Viewport; 90 | 91 | //# sourceMappingURL=Viewport.js.map 92 | -------------------------------------------------------------------------------- /static/xterm/lib/Viewport.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/Viewport.ts"],"names":[],"mappings":";;AAWA;IAaE,kBACU,QAAmB,EACnB,eAA4B,EAC5B,UAAuB,EACvB,WAAwB;QAJlC,iBAgBC;QAfS,aAAQ,GAAR,QAAQ,CAAW;QACnB,oBAAe,GAAf,eAAe,CAAa;QAC5B,eAAU,GAAV,UAAU,CAAa;QACvB,gBAAW,GAAX,WAAW,CAAa;QAEhC,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,wBAAwB,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,0BAA0B,GAAG,CAAC,CAAC;QAEpC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CA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AAC;QACtC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,MAAM,CAAC;QACT,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,SAAS,IAAI,MAAM,CAAC;QACzC,EAAE,CAAC,cAAc,EAAE,CAAC;IACtB,CAAC;IAAA,CAAC;IACJ,eAAC;AAAD,CArIA,AAqIC,IAAA;AArIY,4BAAQ","file":"Viewport.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/Viewport.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var chai_1 = require("chai"); 4 | var Viewport_1 = require("./Viewport"); 5 | var BufferSet_1 = require("./BufferSet"); 6 | describe('Viewport', function () { 7 | var terminal; 8 | var viewportElement; 9 | var charMeasure; 10 | var viewport; 11 | var scrollAreaElement; 12 | var CHARACTER_HEIGHT = 10; 13 | beforeEach(function () { 14 | terminal = { 15 | rows: 0, 16 | ydisp: 0, 17 | on: function () { }, 18 | rowContainer: { 19 | style: { 20 | lineHeight: 0 21 | } 22 | }, 23 | selectionContainer: { 24 | style: { 25 | height: 0 26 | } 27 | }, 28 | scrollback: 10 29 | }; 30 | terminal.buffers = new BufferSet_1.BufferSet(terminal); 31 | terminal.buffer = terminal.buffers.active; 32 | viewportElement = { 33 | addEventListener: function () { }, 34 | style: { 35 | height: 0, 36 | lineHeight: 0 37 | } 38 | }; 39 | scrollAreaElement = { 40 | style: { 41 | height: 0 42 | } 43 | }; 44 | charMeasure = { 45 | height: CHARACTER_HEIGHT 46 | }; 47 | viewport = new Viewport_1.Viewport(terminal, viewportElement, scrollAreaElement, charMeasure); 48 | }); 49 | describe('refresh', function () { 50 | it('should set the line-height of the terminal', function (done) { 51 | setTimeout(function () { 52 | chai_1.assert.equal(viewportElement.style.lineHeight, CHARACTER_HEIGHT + 'px'); 53 | chai_1.assert.equal(terminal.rowContainer.style.lineHeight, CHARACTER_HEIGHT + 'px'); 54 | charMeasure.height = 1; 55 | viewport.refresh(); 56 | chai_1.assert.equal(viewportElement.style.lineHeight, '1px'); 57 | chai_1.assert.equal(terminal.rowContainer.style.lineHeight, '1px'); 58 | done(); 59 | }, 0); 60 | }); 61 | it('should set the height of the viewport when the line-height changed', function () { 62 | terminal.buffer.lines.push(''); 63 | terminal.buffer.lines.push(''); 64 | terminal.rows = 1; 65 | viewport.refresh(); 66 | chai_1.assert.equal(viewportElement.style.height, 1 * CHARACTER_HEIGHT + 'px'); 67 | charMeasure.height = 2 * CHARACTER_HEIGHT; 68 | viewport.refresh(); 69 | chai_1.assert.equal(viewportElement.style.height, 2 * CHARACTER_HEIGHT + 'px'); 70 | }); 71 | }); 72 | describe('syncScrollArea', function () { 73 | it('should sync the scroll area', function (done) { 74 | setTimeout(function () { 75 | terminal.buffer.lines.push(''); 76 | terminal.rows = 1; 77 | chai_1.assert.equal(scrollAreaElement.style.height, 0 * CHARACTER_HEIGHT + 'px'); 78 | viewport.syncScrollArea(); 79 | chai_1.assert.equal(viewportElement.style.height, 1 * CHARACTER_HEIGHT + 'px'); 80 | chai_1.assert.equal(scrollAreaElement.style.height, 1 * CHARACTER_HEIGHT + 'px'); 81 | terminal.buffer.lines.push(''); 82 | viewport.syncScrollArea(); 83 | chai_1.assert.equal(viewportElement.style.height, 1 * CHARACTER_HEIGHT + 'px'); 84 | chai_1.assert.equal(scrollAreaElement.style.height, 2 * CHARACTER_HEIGHT + 'px'); 85 | done(); 86 | }, 0); 87 | }); 88 | }); 89 | }); 90 | 91 | //# sourceMappingURL=Viewport.test.js.map 92 | -------------------------------------------------------------------------------- /static/xterm/lib/Viewport.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/Viewport.test.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAC9B,uCAAsC;AACtC,yCAAsC;AAEtC,QAAQ,CAAC,UAAU,EAAE;IACnB,IAAI,QAAQ,CAAC;IACb,IAAI,eAAe,CAAC;IACpB,IAAI,WA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AAK,CAAC,MAAM,EAAE,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAAC,CAAC;gBAC1E,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAC1B,aAAM,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAAC,CAAC;gBACxE,aAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAAC,CAAC;gBAC1E,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC/B,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAC1B,aAAM,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAAC,CAAC;gBACxE,aAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAAC,CAAC;gBAC1E,IAAI,EAAE,CAAC;YACT,CAAC,EAAE,CAAC,CAAC,CAAC;QACR,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"Viewport.test.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/addons/attach/attach.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implements the attach method, that attaches the terminal to a WebSocket stream. 3 | * @module xterm/addons/attach/attach 4 | * @license MIT 5 | */ 6 | 7 | (function (attach) { 8 | if (typeof exports === 'object' && typeof module === 'object') { 9 | /* 10 | * CommonJS environment 11 | */ 12 | module.exports = attach(require('../../xterm')); 13 | } else if (typeof define == 'function') { 14 | /* 15 | * Require.js is available 16 | */ 17 | define(['../../xterm'], attach); 18 | } else { 19 | /* 20 | * Plain browser environment 21 | */ 22 | attach(window.Terminal); 23 | } 24 | })(function (Xterm) { 25 | 'use strict'; 26 | 27 | var exports = {}; 28 | 29 | /** 30 | * Attaches the given terminal to the given socket. 31 | * 32 | * @param {Xterm} term - The terminal to be attached to the given socket. 33 | * @param {WebSocket} socket - The socket to attach the current terminal. 34 | * @param {boolean} bidirectional - Whether the terminal should send data 35 | * to the socket as well. 36 | * @param {boolean} buffered - Whether the rendering of incoming data 37 | * should happen instantly or at a maximum 38 | * frequency of 1 rendering per 10ms. 39 | */ 40 | exports.attach = function (term, socket, bidirectional, buffered) { 41 | bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional; 42 | term.socket = socket; 43 | 44 | term._flushBuffer = function () { 45 | term.write(term._attachSocketBuffer); 46 | term._attachSocketBuffer = null; 47 | clearTimeout(term._attachSocketBufferTimer); 48 | term._attachSocketBufferTimer = null; 49 | }; 50 | 51 | term._pushToBuffer = function (data) { 52 | if (term._attachSocketBuffer) { 53 | term._attachSocketBuffer += data; 54 | } else { 55 | term._attachSocketBuffer = data; 56 | setTimeout(term._flushBuffer, 10); 57 | } 58 | }; 59 | 60 | term._getMessage = function (ev) { 61 | if (buffered) { 62 | term._pushToBuffer(ev.data); 63 | } else { 64 | term.write(ev.data); 65 | } 66 | }; 67 | 68 | term._sendData = function (data) { 69 | socket.send(data); 70 | }; 71 | 72 | socket.addEventListener('message', term._getMessage); 73 | 74 | if (bidirectional) { 75 | term.on('data', term._sendData); 76 | } 77 | 78 | socket.addEventListener('close', term.detach.bind(term, socket)); 79 | socket.addEventListener('error', term.detach.bind(term, socket)); 80 | }; 81 | 82 | /** 83 | * Detaches the given terminal from the given socket 84 | * 85 | * @param {Xterm} term - The terminal to be detached from the given socket. 86 | * @param {WebSocket} socket - The socket from which to detach the current 87 | * terminal. 88 | */ 89 | exports.detach = function (term, socket) { 90 | term.off('data', term._sendData); 91 | 92 | socket = (typeof socket == 'undefined') ? term.socket : socket; 93 | 94 | if (socket) { 95 | socket.removeEventListener('message', term._getMessage); 96 | } 97 | 98 | delete term.socket; 99 | }; 100 | 101 | /** 102 | * Attaches the current terminal to the given socket 103 | * 104 | * @param {WebSocket} socket - The socket to attach the current terminal. 105 | * @param {boolean} bidirectional - Whether the terminal should send data 106 | * to the socket as well. 107 | * @param {boolean} buffered - Whether the rendering of incoming data 108 | * should happen instantly or at a maximum 109 | * frequency of 1 rendering per 10ms. 110 | */ 111 | Xterm.prototype.attach = function (socket, bidirectional, buffered) { 112 | return exports.attach(this, socket, bidirectional, buffered); 113 | }; 114 | 115 | /** 116 | * Detaches the current terminal from the given socket. 117 | * 118 | * @param {WebSocket} socket - The socket from which to detach the current 119 | * terminal. 120 | */ 121 | Xterm.prototype.detach = function (socket) { 122 | return exports.detach(this, socket); 123 | }; 124 | 125 | return exports; 126 | }); 127 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/attach/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.attach", 3 | "main": "attach.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/fit/fit.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Fit terminal columns and rows to the dimensions of its DOM element. 3 | * 4 | * ## Approach 5 | * - Rows: Truncate the division of the terminal parent element height by the terminal row height. 6 | * 7 | * - Columns: Truncate the division of the terminal parent element width by the terminal character 8 | * width (apply display: inline at the terminal row and truncate its width with the current 9 | * number of columns). 10 | * @module xterm/addons/fit/fit 11 | * @license MIT 12 | */ 13 | 14 | (function (fit) { 15 | if (typeof exports === 'object' && typeof module === 'object') { 16 | /* 17 | * CommonJS environment 18 | */ 19 | module.exports = fit(require('../../xterm')); 20 | } else if (typeof define == 'function') { 21 | /* 22 | * Require.js is available 23 | */ 24 | define(['../../xterm'], fit); 25 | } else { 26 | /* 27 | * Plain browser environment 28 | */ 29 | fit(window.Terminal); 30 | } 31 | })(function (Xterm) { 32 | var exports = {}; 33 | 34 | exports.proposeGeometry = function (term) { 35 | if (!term.element.parentElement) { 36 | return null; 37 | } 38 | var parentElementStyle = window.getComputedStyle(term.element.parentElement), 39 | parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')), 40 | parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')) - 17), 41 | elementStyle = window.getComputedStyle(term.element), 42 | elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')), 43 | elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')), 44 | availableHeight = parentElementHeight - elementPaddingVer, 45 | availableWidth = parentElementWidth - elementPaddingHor, 46 | container = term.rowContainer, 47 | subjectRow = term.rowContainer.firstElementChild, 48 | contentBuffer = subjectRow.innerHTML, 49 | characterHeight, 50 | rows, 51 | characterWidth, 52 | cols, 53 | geometry; 54 | 55 | subjectRow.style.display = 'inline'; 56 | subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace 57 | characterWidth = subjectRow.getBoundingClientRect().width; 58 | subjectRow.style.display = ''; // Revert style before calculating height, since they differ. 59 | characterHeight = subjectRow.getBoundingClientRect().height; 60 | subjectRow.innerHTML = contentBuffer; 61 | 62 | rows = parseInt(availableHeight / characterHeight); 63 | cols = parseInt(availableWidth / characterWidth); 64 | 65 | geometry = {cols: cols, rows: rows}; 66 | return geometry; 67 | }; 68 | 69 | exports.fit = function (term) { 70 | var geometry = exports.proposeGeometry(term); 71 | 72 | if (geometry) { 73 | term.resize(geometry.cols, geometry.rows); 74 | } 75 | }; 76 | 77 | Xterm.prototype.proposeGeometry = function () { 78 | return exports.proposeGeometry(this); 79 | }; 80 | 81 | Xterm.prototype.fit = function () { 82 | return exports.fit(this); 83 | }; 84 | 85 | return exports; 86 | }); 87 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/fit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.fit", 3 | "main": "fit.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/fullscreen/fullscreen.css: -------------------------------------------------------------------------------- 1 | .xterm.fullscreen { 2 | position: fixed; 3 | top: 0; 4 | bottom: 0; 5 | left: 0; 6 | right: 0; 7 | width: auto; 8 | height: auto; 9 | z-index: 255; 10 | } 11 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/fullscreen/fullscreen.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Fullscreen addon for xterm.js 3 | * @module xterm/addons/fullscreen/fullscreen 4 | * @license MIT 5 | */ 6 | (function (fullscreen) { 7 | if (typeof exports === 'object' && typeof module === 'object') { 8 | /* 9 | * CommonJS environment 10 | */ 11 | module.exports = fullscreen(require('../../xterm')); 12 | } else if (typeof define == 'function') { 13 | /* 14 | * Require.js is available 15 | */ 16 | define(['../../xterm'], fullscreen); 17 | } else { 18 | /* 19 | * Plain browser environment 20 | */ 21 | fullscreen(window.Terminal); 22 | } 23 | })(function (Xterm) { 24 | var exports = {}; 25 | 26 | /** 27 | * Toggle the given terminal's fullscreen mode. 28 | * @param {Xterm} term - The terminal to toggle full screen mode 29 | * @param {boolean} fullscreen - Toggle fullscreen on (true) or off (false) 30 | */ 31 | exports.toggleFullScreen = function (term, fullscreen) { 32 | var fn; 33 | 34 | if (typeof fullscreen == 'undefined') { 35 | fn = (term.element.classList.contains('fullscreen')) ? 'remove' : 'add'; 36 | } else if (!fullscreen) { 37 | fn = 'remove'; 38 | } else { 39 | fn = 'add'; 40 | } 41 | 42 | term.element.classList[fn]('fullscreen'); 43 | }; 44 | 45 | Xterm.prototype.toggleFullscreen = function (fullscreen) { 46 | exports.toggleFullScreen(this, fullscreen); 47 | }; 48 | 49 | return exports; 50 | }); 51 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/fullscreen/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.fullscreen", 3 | "main": "fullscreen.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/search/SearchHelper.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var SearchHelper = (function () { 4 | function SearchHelper(_terminal, _translateBufferLineToString) { 5 | this._terminal = _terminal; 6 | this._translateBufferLineToString = _translateBufferLineToString; 7 | } 8 | SearchHelper.prototype.findNext = function (term) { 9 | if (!term || term.length === 0) { 10 | return false; 11 | } 12 | var result; 13 | var startRow = this._terminal.buffer.ydisp; 14 | if (this._terminal.selectionManager.selectionEnd) { 15 | startRow = this._terminal.selectionManager.selectionEnd[1]; 16 | } 17 | for (var y = startRow + 1; y < this._terminal.buffer.ybase + this._terminal.rows; y++) { 18 | result = this._findInLine(term, y); 19 | if (result) { 20 | break; 21 | } 22 | } 23 | if (!result) { 24 | for (var y = 0; y < startRow; y++) { 25 | result = this._findInLine(term, y); 26 | if (result) { 27 | break; 28 | } 29 | } 30 | } 31 | return this._selectResult(result); 32 | }; 33 | SearchHelper.prototype.findPrevious = function (term) { 34 | if (!term || term.length === 0) { 35 | return false; 36 | } 37 | var result; 38 | var startRow = this._terminal.buffer.ydisp; 39 | if (this._terminal.selectionManager.selectionStart) { 40 | startRow = this._terminal.selectionManager.selectionStart[1]; 41 | } 42 | for (var y = startRow - 1; y >= 0; y--) { 43 | result = this._findInLine(term, y); 44 | if (result) { 45 | break; 46 | } 47 | } 48 | if (!result) { 49 | for (var y = this._terminal.buffer.ybase + this._terminal.rows - 1; y > startRow; y--) { 50 | result = this._findInLine(term, y); 51 | if (result) { 52 | break; 53 | } 54 | } 55 | } 56 | return this._selectResult(result); 57 | }; 58 | SearchHelper.prototype._findInLine = function (term, y) { 59 | var bufferLine = this._terminal.buffer.lines.get(y); 60 | var lowerStringLine = this._translateBufferLineToString(bufferLine, true).toLowerCase(); 61 | var lowerTerm = term.toLowerCase(); 62 | var searchIndex = lowerStringLine.indexOf(lowerTerm); 63 | if (searchIndex >= 0) { 64 | return { 65 | term: term, 66 | col: searchIndex, 67 | row: y 68 | }; 69 | } 70 | }; 71 | SearchHelper.prototype._selectResult = function (result) { 72 | if (!result) { 73 | return false; 74 | } 75 | this._terminal.selectionManager.setSelection(result.col, result.row, result.term.length); 76 | this._terminal.scrollDisp(result.row - this._terminal.buffer.ydisp, false); 77 | return true; 78 | }; 79 | return SearchHelper; 80 | }()); 81 | exports.SearchHelper = SearchHelper; 82 | 83 | //# sourceMappingURL=SearchHelper.js.map 84 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/search/SearchHelper.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/addons/search/SearchHelper.ts"],"names":[],"mappings":";;AAgBA;IACE,sBAAoB,SAAc,EAAU,4BAAiC;QAAzD,cAAS,GAAT,SAAS,CAAK;QAAU,iCAA4B,GAA5B,4BAA4B,CAAK;IAK7E,CAAC;IAQM,+BAAQ,GAAf,UAAgB,IAAY;QAC1B,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,CAAC,KAAK,CAAC;QACf,CAAC;QAED,IAAI,MAAqB,CAAC;QAE1B,IAAI,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3C,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;YAEjD,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC;QAGD,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YACtF,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YACnC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBACX,KAAK,CAAC;YACR,CAAC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,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3E,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IACH,mBAAC;AAAD,CA3HA,AA2HC,IAAA;AA3HY,oCAAY","file":"SearchHelper.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/addons/search/search.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var SearchHelper_1 = require("./SearchHelper"); 4 | (function (addon) { 5 | if ('Terminal' in window) { 6 | addon(window.Terminal); 7 | } 8 | else if (typeof exports === 'object' && typeof module === 'object') { 9 | module.exports = addon(require('../../xterm')); 10 | } 11 | else if (typeof define == 'function') { 12 | define(['../../xterm'], addon); 13 | } 14 | })(function (Terminal) { 15 | Terminal.prototype.findNext = function (term) { 16 | if (!this._searchHelper) { 17 | this.searchHelper = new SearchHelper_1.SearchHelper(this, Terminal.translateBufferLineToString); 18 | } 19 | return this.searchHelper.findNext(term); 20 | }; 21 | Terminal.prototype.findPrevious = function (term) { 22 | if (!this._searchHelper) { 23 | this.searchHelper = new SearchHelper_1.SearchHelper(this, Terminal.translateBufferLineToString); 24 | } 25 | return this.searchHelper.findPrevious(term); 26 | }; 27 | }); 28 | 29 | //# sourceMappingURL=search.js.map 30 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/search/search.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../../../src/addons/search/search.ts"],"names":[],"mappings":";;AAIA,+CAA8C;AAQ9C,CAAC,UAAU,KAAK;IACd,EAAE,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC,CAAC,CAAC;QAIzB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC;QAIrE,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IACjD,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC;QAIvC,MAAM,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;AACH,CAAC,CAAC,CAAC,UAAC,QAAa;IAOf,QAAQ,CAAC,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAY;QACjD,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,IAAI,2BAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,2BAA2B,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,CAAgB,IAAI,CAAC,YAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC,CAAC;IAQF,QAAQ,CAAC,SAAS,CAAC,YAAY,GAAG,UAAS,IAAY;QACrD,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,IAAI,2BAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,2BAA2B,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,CAAgB,IAAI,CAAC,YAAa,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","file":"search.js","sourceRoot":"."} -------------------------------------------------------------------------------- /static/xterm/lib/addons/terminado/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.terminado", 3 | "main": "terminado.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/lib/addons/terminado/terminado.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This module provides methods for attaching a terminal to a terminado WebSocket stream. 3 | * 4 | * @module xterm/addons/terminado/terminado 5 | * @license MIT 6 | */ 7 | 8 | (function (attach) { 9 | if (typeof exports === 'object' && typeof module === 'object') { 10 | /* 11 | * CommonJS environment 12 | */ 13 | module.exports = attach(require('../../xterm')); 14 | } else if (typeof define == 'function') { 15 | /* 16 | * Require.js is available 17 | */ 18 | define(['../../xterm'], attach); 19 | } else { 20 | /* 21 | * Plain browser environment 22 | */ 23 | attach(window.Terminal); 24 | } 25 | })(function (Xterm) { 26 | 'use strict'; 27 | 28 | var exports = {}; 29 | 30 | /** 31 | * Attaches the given terminal to the given socket. 32 | * 33 | * @param {Xterm} term - The terminal to be attached to the given socket. 34 | * @param {WebSocket} socket - The socket to attach the current terminal. 35 | * @param {boolean} bidirectional - Whether the terminal should send data 36 | * to the socket as well. 37 | * @param {boolean} buffered - Whether the rendering of incoming data 38 | * should happen instantly or at a maximum 39 | * frequency of 1 rendering per 10ms. 40 | */ 41 | exports.terminadoAttach = function (term, socket, bidirectional, buffered) { 42 | bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional; 43 | term.socket = socket; 44 | 45 | term._flushBuffer = function () { 46 | term.write(term._attachSocketBuffer); 47 | term._attachSocketBuffer = null; 48 | clearTimeout(term._attachSocketBufferTimer); 49 | term._attachSocketBufferTimer = null; 50 | }; 51 | 52 | term._pushToBuffer = function (data) { 53 | if (term._attachSocketBuffer) { 54 | term._attachSocketBuffer += data; 55 | } else { 56 | term._attachSocketBuffer = data; 57 | setTimeout(term._flushBuffer, 10); 58 | } 59 | }; 60 | 61 | term._getMessage = function (ev) { 62 | var data = JSON.parse(ev.data) 63 | if( data[0] == "stdout" ) { 64 | if (buffered) { 65 | term._pushToBuffer(data[1]); 66 | } else { 67 | term.write(data[1]); 68 | } 69 | } 70 | }; 71 | 72 | term._sendData = function (data) { 73 | socket.send(JSON.stringify(['stdin', data])); 74 | }; 75 | 76 | term._setSize = function (size) { 77 | socket.send(JSON.stringify(['set_size', size.rows, size.cols])); 78 | }; 79 | 80 | socket.addEventListener('message', term._getMessage); 81 | 82 | if (bidirectional) { 83 | term.on('data', term._sendData); 84 | } 85 | term.on('resize', term._setSize); 86 | 87 | socket.addEventListener('close', term.terminadoDetach.bind(term, socket)); 88 | socket.addEventListener('error', term.terminadoDetach.bind(term, socket)); 89 | }; 90 | 91 | /** 92 | * Detaches the given terminal from the given socket 93 | * 94 | * @param {Xterm} term - The terminal to be detached from the given socket. 95 | * @param {WebSocket} socket - The socket from which to detach the current 96 | * terminal. 97 | */ 98 | exports.terminadoDetach = function (term, socket) { 99 | term.off('data', term._sendData); 100 | 101 | socket = (typeof socket == 'undefined') ? term.socket : socket; 102 | 103 | if (socket) { 104 | socket.removeEventListener('message', term._getMessage); 105 | } 106 | 107 | delete term.socket; 108 | }; 109 | 110 | /** 111 | * Attaches the current terminal to the given socket 112 | * 113 | * @param {WebSocket} socket - The socket to attach the current terminal. 114 | * @param {boolean} bidirectional - Whether the terminal should send data 115 | * to the socket as well. 116 | * @param {boolean} buffered - Whether the rendering of incoming data 117 | * should happen instantly or at a maximum 118 | * frequency of 1 rendering per 10ms. 119 | */ 120 | Xterm.prototype.terminadoAttach = function (socket, bidirectional, buffered) { 121 | return exports.terminadoAttach(this, socket, bidirectional, buffered); 122 | }; 123 | 124 | /** 125 | * Detaches the current terminal from the given socket. 126 | * 127 | * @param {WebSocket} socket - The socket from which to detach the current 128 | * terminal. 129 | */ 130 | Xterm.prototype.terminadoDetach = function (socket) { 131 | return exports.terminadoDetach(this, socket); 132 | }; 133 | 134 | return exports; 135 | }); 136 | -------------------------------------------------------------------------------- /static/xterm/lib/handlers/Clipboard.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function prepareTextForTerminal(text, isMSWindows) { 4 | if (isMSWindows) { 5 | return text.replace(/\r?\n/g, '\r'); 6 | } 7 | return text; 8 | } 9 | exports.prepareTextForTerminal = prepareTextForTerminal; 10 | function copyHandler(ev, term, selectionManager) { 11 | if (term.browser.isMSIE) { 12 | window.clipboardData.setData('Text', selectionManager.selectionText); 13 | } 14 | else { 15 | ev.clipboardData.setData('text/plain', selectionManager.selectionText); 16 | } 17 | ev.preventDefault(); 18 | } 19 | exports.copyHandler = copyHandler; 20 | function pasteHandler(ev, term) { 21 | ev.stopPropagation(); 22 | var text; 23 | var dispatchPaste = function (text) { 24 | text = prepareTextForTerminal(text, term.browser.isMSWindows); 25 | term.handler(text); 26 | term.textarea.value = ''; 27 | term.emit('paste', text); 28 | return term.cancel(ev); 29 | }; 30 | if (term.browser.isMSIE) { 31 | if (window.clipboardData) { 32 | text = window.clipboardData.getData('Text'); 33 | dispatchPaste(text); 34 | } 35 | } 36 | else { 37 | if (ev.clipboardData) { 38 | text = ev.clipboardData.getData('text/plain'); 39 | dispatchPaste(text); 40 | } 41 | } 42 | } 43 | exports.pasteHandler = pasteHandler; 44 | function moveTextAreaUnderMouseCursor(ev, textarea) { 45 | textarea.style.position = 'fixed'; 46 | textarea.style.width = '20px'; 47 | textarea.style.height = '20px'; 48 | textarea.style.left = (ev.clientX - 10) + 'px'; 49 | textarea.style.top = (ev.clientY - 10) + 'px'; 50 | textarea.style.zIndex = '1000'; 51 | textarea.focus(); 52 | setTimeout(function () { 53 | textarea.style.position = null; 54 | textarea.style.width = null; 55 | textarea.style.height = null; 56 | textarea.style.left = null; 57 | textarea.style.top = null; 58 | textarea.style.zIndex = null; 59 | }, 4); 60 | } 61 | exports.moveTextAreaUnderMouseCursor = moveTextAreaUnderMouseCursor; 62 | function rightClickHandler(ev, textarea, selectionManager) { 63 | moveTextAreaUnderMouseCursor(ev, textarea); 64 | textarea.value = selectionManager.selectionText; 65 | textarea.select(); 66 | } 67 | exports.rightClickHandler = rightClickHandler; 68 | 69 | //# sourceMappingURL=Clipboard.js.map 70 | -------------------------------------------------------------------------------- /static/xterm/lib/handlers/Clipboard.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/handlers/Clipboard.ts"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CAAC;IAC/B,CAAC,EAAE,CAAC,CAAC,CAAC;AACR,CAAC;AApBD,oEAoBC;AAQD,2BAAkC,EAAc,EAAE,QAA6B,EAAE,gBAAmC;IAClH,4BAA4B,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAG3C,QAAQ,CAAC,KAAK,GAAG,gBAAgB,CAAC,aAAa,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,CAAC;AACpB,CAAC;AAND,8CAMC","file":"Clipboard.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/handlers/Clipboard.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var chai_1 = require("chai"); 4 | var Clipboard = require("./Clipboard"); 5 | describe('evaluatePastedTextProcessing', function () { 6 | it('should replace carriage return + line feed with line feed on windows', function () { 7 | var pastedText = 'foo\r\nbar\r\n', processedText = Clipboard.prepareTextForTerminal(pastedText, false), windowsProcessedText = Clipboard.prepareTextForTerminal(pastedText, true); 8 | chai_1.assert.equal(processedText, 'foo\r\nbar\r\n'); 9 | chai_1.assert.equal(windowsProcessedText, 'foo\rbar\r'); 10 | }); 11 | }); 12 | 13 | //# sourceMappingURL=Clipboard.test.js.map 14 | -------------------------------------------------------------------------------- /static/xterm/lib/handlers/Clipboard.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/handlers/Clipboard.test.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAE9B,uCAAyC;AAEzC,QAAQ,CAAC,8BAA8B,EAAE;IACvC,EAAE,CAAC,sEAAsE,EAAE;QACzE,IAAM,UAAU,GAAG,gBAAgB,EAC7B,aAAa,GAAG,SAAS,CAAC,sBAAsB,CAAC,UAAU,EAAE,KAAK,CAAC,EACnE,oBAAoB,GAAG,SAAS,CAAC,sBAAsB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAEhF,aAAM,CAAC,KAAK,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;QAC9C,aAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"Clipboard.test.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/test/addons/test.js: -------------------------------------------------------------------------------- 1 | var assert = require('chai').assert; 2 | var Terminal = require('../../xterm'); 3 | describe('xterm.js addons', function () { 4 | it('should load addons with Terminal.loadAddon', function () { 5 | Terminal.loadAddon('attach'); 6 | assert.equal(typeof Terminal.prototype.attach, 'function'); 7 | }); 8 | }); 9 | 10 | //# sourceMappingURL=test.js.map 11 | -------------------------------------------------------------------------------- /static/xterm/lib/test/addons/test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/test/addons/test.js"],"names":[],"mappings":"AAAA,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;AACpC,IAAI,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAEtC,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,EAAE,CAAC,4CAA4C,EAAE;QAC/C,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE7B,MAAM,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"test.js","sourceRoot":"../.."} -------------------------------------------------------------------------------- /static/xterm/lib/test/escape-sequences-test.js: -------------------------------------------------------------------------------- 1 | var glob = require('glob'); 2 | var fs = require('fs'); 3 | var os = require('os'); 4 | var pty = require('node-pty'); 5 | var Terminal = require('../xterm'); 6 | if (os.platform() === 'win32') { 7 | return; 8 | } 9 | var CONSOLE_LOG = console.log; 10 | var COLS = 80; 11 | var ROWS = 25; 12 | var primitive_pty = pty.native.open(COLS, ROWS); 13 | function ptyWriteRead(s, cb) { 14 | fs.writeSync(primitive_pty.slave, s); 15 | setTimeout(function () { 16 | var b = Buffer(64000); 17 | var bytes = fs.readSync(primitive_pty.master, b, 0, 64000); 18 | cb(b.toString('utf8', 0, bytes)); 19 | }); 20 | } 21 | function ptyReset(cb) { 22 | ptyWriteRead('\r\n', cb); 23 | } 24 | function formatError(in_, out_, expected) { 25 | function addLineNumber(start, color) { 26 | var counter = start || 0; 27 | return function (s) { 28 | counter += 1; 29 | return '\x1b[33m' + (' ' + counter).slice(-2) + color + s; 30 | }; 31 | } 32 | var line80 = '12345678901234567890123456789012345678901234567890123456789012345678901234567890'; 33 | var s = ''; 34 | s += '\n\x1b[34m' + JSON.stringify(in_); 35 | s += '\n\x1b[33m ' + line80 + '\n'; 36 | s += out_.split('\n').map(addLineNumber(0, '\x1b[31m')).join('\n'); 37 | s += '\n\x1b[33m ' + line80 + '\n'; 38 | s += expected.split('\n').map(addLineNumber(0, '\x1b[32m')).join('\n'); 39 | return s; 40 | } 41 | function terminalToString(term) { 42 | var result = ''; 43 | var line_s = ''; 44 | for (var line = term.buffer.ybase; line < term.buffer.ybase + term.rows; line++) { 45 | line_s = ''; 46 | for (var cell = 0; cell < term.cols; ++cell) { 47 | line_s += term.buffer.lines.get(line)[cell][1]; 48 | } 49 | line_s = line_s.replace(/\s+$/, ''); 50 | result += line_s; 51 | result += '\n'; 52 | } 53 | return result; 54 | } 55 | describe('xterm output comparison', function () { 56 | var xterm; 57 | beforeEach(function () { 58 | xterm = new Terminal(COLS, ROWS); 59 | xterm.refresh = function () { }; 60 | xterm.viewport = { 61 | syncScrollArea: function () { } 62 | }; 63 | }); 64 | Error.stackTraceLimit = 0; 65 | var files = glob.sync('**/escape_sequence_files/*.in'); 66 | var skip = [ 67 | 10, 16, 17, 19, 32, 33, 34, 35, 36, 39, 68 | 40, 42, 43, 44, 45, 46, 47, 48, 49, 50, 69 | 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 70 | 63, 68 71 | ]; 72 | if (os.platform() === 'darwin') { 73 | skip.push(3, 7, 11, 67); 74 | } 75 | for (var i = 0; i < files.length; i++) { 76 | if (skip.indexOf(i) >= 0) { 77 | continue; 78 | } 79 | (function (filename) { 80 | it(filename.split('/').slice(-1)[0], function (done) { 81 | ptyReset(function () { 82 | var in_file = fs.readFileSync(filename, 'utf8'); 83 | ptyWriteRead(in_file, function (from_pty) { 84 | xterm.writeBuffer.push(from_pty); 85 | xterm.innerWrite(); 86 | var from_emulator = terminalToString(xterm); 87 | console.log = CONSOLE_LOG; 88 | var expected = fs.readFileSync(filename.split('.')[0] + '.text', 'utf8'); 89 | var expectedRightTrimmed = expected.split('\n').map(function (l) { 90 | return l.replace(/\s+$/, ''); 91 | }).join('\n'); 92 | if (from_emulator != expectedRightTrimmed) { 93 | throw new Error(formatError(in_file, from_emulator, expected)); 94 | } 95 | done(); 96 | }); 97 | }); 98 | }); 99 | })(files[i]); 100 | } 101 | }); 102 | 103 | //# sourceMappingURL=escape-sequences-test.js.map 104 | -------------------------------------------------------------------------------- /static/xterm/lib/test/escape-sequences-test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/test/escape-sequences-test.js"],"names":[],"mappings":"AAAA,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,IAAI,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC9B,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEnC,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC;IAE9B,MAAM,CAAC;AACT,CAAC;AAED,IAAI,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;AAG9B,IAAI,IAAI,GAAG,EAAE,CAAC;AACd,IAAI,IAAI,GAAG,EAAE,CAAC;AAKd,IAA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C,QAAQ,EAAE,MAAM,CAAC,CAAC;oBAChD,YAAY,CAAC,OAAO,EAAE,UAAA,QAAQ;wBAK5B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACjC,KAAK,CAAC,UAAU,EAAE,CAAC;wBAEnB,IAAI,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;wBAC5C,OAAO,CAAC,GAAG,GAAG,WAAW,CAAC;wBAC1B,IAAI,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC;wBAGzE,IAAI,oBAAoB,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;4BAC7D,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;wBAC/B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBACd,EAAE,CAAC,CAAC,aAAa,IAAI,oBAAoB,CAAC,CAAC,CAAC;4BAE1C,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;wBAEjE,CAAC;wBACD,IAAI,EAAE,CAAC;oBACT,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC","file":"escape-sequences-test.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/Browser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var Generic_1 = require("./Generic"); 4 | var isNode = (typeof navigator === 'undefined') ? true : false; 5 | var userAgent = (isNode) ? 'node' : navigator.userAgent; 6 | var platform = (isNode) ? 'node' : navigator.platform; 7 | exports.isFirefox = !!~userAgent.indexOf('Firefox'); 8 | exports.isMSIE = !!~userAgent.indexOf('MSIE') || !!~userAgent.indexOf('Trident'); 9 | exports.isMac = Generic_1.contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform); 10 | exports.isIpad = platform === 'iPad'; 11 | exports.isIphone = platform === 'iPhone'; 12 | exports.isMSWindows = Generic_1.contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform); 13 | exports.isLinux = platform.indexOf('Linux') >= 0; 14 | 15 | //# sourceMappingURL=Browser.js.map 16 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/Browser.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/utils/Browser.ts"],"names":[],"mappings":";;AAMA,qCAAqC;AAErC,IAAM,MAAM,GAAG,CAAC,OAAO,SAAS,KAAK,WAAW,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AACjE,IAAM,SAAS,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC;AAC1D,IAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC;AAE3C,QAAA,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAC5C,QAAA,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAKzE,QAAA,KAAK,GAAG,kBAAQ,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC1E,QAAA,MAAM,GAAG,QAAQ,KAAK,MAAM,CAAC;AAC7B,QAAA,QAAQ,GAAG,QAAQ,KAAK,QAAQ,CAAC;AACjC,QAAA,WAAW,GAAG,kBAAQ,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AACzE,QAAA,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","file":"Browser.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/BufferLine.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var LINE_DATA_CHAR_INDEX = 1; 4 | var LINE_DATA_WIDTH_INDEX = 2; 5 | function translateBufferLineToString(line, trimRight, startCol, endCol) { 6 | if (startCol === void 0) { startCol = 0; } 7 | if (endCol === void 0) { endCol = null; } 8 | var lineString = ''; 9 | var widthAdjustedStartCol = startCol; 10 | var widthAdjustedEndCol = endCol; 11 | for (var i = 0; i < line.length; i++) { 12 | var char = line[i]; 13 | lineString += char[LINE_DATA_CHAR_INDEX]; 14 | if (char[LINE_DATA_WIDTH_INDEX] === 0) { 15 | if (startCol >= i) { 16 | widthAdjustedStartCol--; 17 | } 18 | if (endCol >= i) { 19 | widthAdjustedEndCol--; 20 | } 21 | } 22 | } 23 | var finalEndCol = widthAdjustedEndCol || line.length; 24 | if (trimRight) { 25 | var rightWhitespaceIndex = lineString.search(/\s+$/); 26 | if (rightWhitespaceIndex !== -1) { 27 | finalEndCol = Math.min(finalEndCol, rightWhitespaceIndex); 28 | } 29 | if (finalEndCol <= widthAdjustedStartCol) { 30 | return ''; 31 | } 32 | } 33 | return lineString.substring(widthAdjustedStartCol, finalEndCol); 34 | } 35 | exports.translateBufferLineToString = translateBufferLineToString; 36 | 37 | //# sourceMappingURL=BufferLine.js.map 38 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/BufferLine.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/utils/BufferLine.ts"],"names":[],"mappings":";;AAMA,IAAM,oBAAoB,GA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C;QACZ,CAAC;IACH,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;AAClE,CAAC;AAnCD,kEAmCC","file":"BufferLine.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/CharMeasure.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 | return function (d, b) { 7 | extendStatics(d, b); 8 | function __() { this.constructor = d; } 9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10 | }; 11 | })(); 12 | Object.defineProperty(exports, "__esModule", { value: true }); 13 | var EventEmitter_js_1 = require("../EventEmitter.js"); 14 | var CharMeasure = (function (_super) { 15 | __extends(CharMeasure, _super); 16 | function CharMeasure(document, parentElement) { 17 | var _this = _super.call(this) || this; 18 | _this._document = document; 19 | _this._parentElement = parentElement; 20 | return _this; 21 | } 22 | Object.defineProperty(CharMeasure.prototype, "width", { 23 | get: function () { 24 | return this._width; 25 | }, 26 | enumerable: true, 27 | configurable: true 28 | }); 29 | Object.defineProperty(CharMeasure.prototype, "height", { 30 | get: function () { 31 | return this._height; 32 | }, 33 | enumerable: true, 34 | configurable: true 35 | }); 36 | CharMeasure.prototype.measure = function () { 37 | var _this = this; 38 | if (!this._measureElement) { 39 | this._measureElement = this._document.createElement('span'); 40 | this._measureElement.style.position = 'absolute'; 41 | this._measureElement.style.top = '0'; 42 | this._measureElement.style.left = '-9999em'; 43 | this._measureElement.textContent = 'W'; 44 | this._measureElement.setAttribute('aria-hidden', 'true'); 45 | this._parentElement.appendChild(this._measureElement); 46 | setTimeout(function () { return _this._doMeasure(); }, 0); 47 | } 48 | else { 49 | this._doMeasure(); 50 | } 51 | }; 52 | CharMeasure.prototype._doMeasure = function () { 53 | var geometry = this._measureElement.getBoundingClientRect(); 54 | if (geometry.width === 0 || geometry.height === 0) { 55 | return; 56 | } 57 | if (this._width !== geometry.width || this._height !== geometry.height) { 58 | this._width = geometry.width; 59 | this._height = geometry.height; 60 | this.emit('charsizechanged'); 61 | } 62 | }; 63 | return CharMeasure; 64 | }(EventEmitter_js_1.EventEmitter)); 65 | exports.CharMeasure = CharMeasure; 66 | 67 | //# sourceMappingURL=CharMeasure.js.map 68 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/CharMeasure.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/utils/CharMeasure.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,sDAAkD;AAKlD;IAAiC,+BAAY;IAO3C,qBAAY,QAAkB,EAAE,aAA0B;QAA1D,YACE,iBAAO,SAGR;QAFC,KAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,KAAI,CAAC,cAAc,GAAG,aAAa,CAAC;;IACtC,CAAC;IAED,sBAAW,8BAAK;aAAhB;YACE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAED,sBAAW,+BAAM;aAAjB;YACE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;;;OAAA;IAEM,6BAAO,GAAd;QAAA,iBAeC;QAdC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC5D,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;YACjD,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;YACrC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;YAC5C,IAAI,CAAC,eAAe,CAAC,WAAW,GAAG,GAAG,CAAC;YACvC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YACzD,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAGtD,UAAU,CAAC,cAAM,OAAA,KAAI,CAAC,UAAU,EAAE,EAAjB,CAAiB,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;IAEO,gCAAU,GAAlB;QACE,IAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,qBAAqB,EAAE,CAAC;QAG9D,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YAClD,MAAM,CAAC;QACT,CAAC;QACD,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACvE,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC7B,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IACH,kBAAC;AAAD,CAnDA,AAmDC,CAnDgC,8BAAY,GAmD5C;AAnDY,kCAAW","file":"CharMeasure.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/CharMeasure.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var jsdom = require("jsdom"); 4 | var chai_1 = require("chai"); 5 | var CharMeasure_1 = require("./CharMeasure"); 6 | describe('CharMeasure', function () { 7 | var dom; 8 | var window; 9 | var document; 10 | var container; 11 | var charMeasure; 12 | beforeEach(function () { 13 | dom = new jsdom.JSDOM(''); 14 | window = dom.window; 15 | document = window.document; 16 | container = document.createElement('div'); 17 | document.body.appendChild(container); 18 | charMeasure = new CharMeasure_1.CharMeasure(document, container); 19 | }); 20 | describe('measure', function () { 21 | it('should set _measureElement on first call', function () { 22 | charMeasure.measure(); 23 | chai_1.assert.isDefined(charMeasure._measureElement, 'CharMeasure.measure should have created _measureElement'); 24 | }); 25 | it('should be performed async on first call', function (done) { 26 | chai_1.assert.equal(charMeasure.width, null); 27 | charMeasure.measure(); 28 | charMeasure._measureElement.getBoundingClientRect = function () { 29 | return { width: 1, height: 1 }; 30 | }; 31 | chai_1.assert.equal(charMeasure.width, null); 32 | setTimeout(function () { 33 | chai_1.assert.equal(charMeasure.width, 1); 34 | done(); 35 | }, 0); 36 | }); 37 | it('should be performed sync on successive calls', function (done) { 38 | charMeasure.measure(); 39 | charMeasure._measureElement.getBoundingClientRect = function () { 40 | return { width: 1, height: 1 }; 41 | }; 42 | setTimeout(function () { 43 | var firstWidth = charMeasure.width; 44 | charMeasure._measureElement.getBoundingClientRect = function () { 45 | return { width: 2, height: 2 }; 46 | }; 47 | charMeasure.measure(); 48 | chai_1.assert.equal(charMeasure.width, firstWidth * 2); 49 | done(); 50 | }, 0); 51 | }); 52 | it('should NOT do a measure when the parent is hidden', function (done) { 53 | charMeasure.measure(); 54 | setTimeout(function () { 55 | var firstWidth = charMeasure.width; 56 | container.style.display = 'none'; 57 | container.style.fontSize = '2em'; 58 | charMeasure.measure(); 59 | chai_1.assert.equal(charMeasure.width, firstWidth); 60 | done(); 61 | }, 0); 62 | }); 63 | }); 64 | }); 65 | 66 | //# sourceMappingURL=CharMeasure.test.js.map 67 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/CharMeasure.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/utils/CharMeasure.test.ts"],"names":[],"mappings":";;AAGA,6BAAgC;AAChC,6BAA8B;AA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ot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/DomElementObjectPool.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var DomElementObjectPool = (function () { 4 | function DomElementObjectPool(type) { 5 | this.type = type; 6 | this._type = type; 7 | this._pool = []; 8 | this._inUse = {}; 9 | } 10 | DomElementObjectPool.prototype.acquire = function () { 11 | var element; 12 | if (this._pool.length === 0) { 13 | element = this._createNew(); 14 | } 15 | else { 16 | element = this._pool.pop(); 17 | } 18 | this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)] = element; 19 | return element; 20 | }; 21 | DomElementObjectPool.prototype.release = function (element) { 22 | if (!this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)]) { 23 | throw new Error('Could not release an element not yet acquired'); 24 | } 25 | delete this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)]; 26 | this._cleanElement(element); 27 | this._pool.push(element); 28 | }; 29 | DomElementObjectPool.prototype._createNew = function () { 30 | var element = document.createElement(this._type); 31 | var id = DomElementObjectPool._objectCount++; 32 | element.setAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE, id.toString(10)); 33 | return element; 34 | }; 35 | DomElementObjectPool.prototype._cleanElement = function (element) { 36 | element.className = ''; 37 | element.innerHTML = ''; 38 | }; 39 | return DomElementObjectPool; 40 | }()); 41 | DomElementObjectPool.OBJECT_ID_ATTRIBUTE = 'data-obj-id'; 42 | DomElementObjectPool._objectCount = 0; 43 | exports.DomElementObjectPool = DomElementObjectPool; 44 | 45 | //# sourceMappingURL=DomElementObjectPool.js.map 46 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/DomElementObjectPool.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/utils/DomElementObjectPool.ts"],"names":[],"mappings":";;AASA;IAYE,8BAAoB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;Q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AAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAChF,MAAM,CAAC,OAAO,CAAC;IACjB,CAAC;IAMO,4CAAa,GAArB,UAAsB,OAAoB;QACxC,OAAO,CAAC,SAAS,GAAG,EAAE,CAAC;QACvB,OAAO,CAAC,SAAS,GAAG,EAAE,CAAC;IACzB,CAAC;IACH,2BAAC;AAAD,CAjEA,AAiEC;AAhEyB,wCAAmB,GAAG,aAAa,CAAC;AAE7C,iCAAY,GAAG,CAAC,CAAC;AAHrB,oDAAoB","file":"DomElementObjectPool.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/DomElementObjectPool.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var chai_1 = require("chai"); 4 | var DomElementObjectPool_1 = require("./DomElementObjectPool"); 5 | var MockDocument = (function () { 6 | function MockDocument() { 7 | this._attr = {}; 8 | } 9 | MockDocument.prototype.getAttribute = function (key) { return this._attr[key]; }; 10 | ; 11 | MockDocument.prototype.setAttribute = function (key, value) { this._attr[key] = value; }; 12 | return MockDocument; 13 | }()); 14 | describe('DomElementObjectPool', function () { 15 | var pool; 16 | beforeEach(function () { 17 | pool = new DomElementObjectPool_1.DomElementObjectPool('span'); 18 | global.document = { 19 | createElement: function () { return new MockDocument(); } 20 | }; 21 | }); 22 | it('should acquire distinct elements', function () { 23 | var element1 = pool.acquire(); 24 | var element2 = pool.acquire(); 25 | chai_1.assert.notEqual(element1, element2); 26 | }); 27 | it('should acquire released elements', function () { 28 | var element = pool.acquire(); 29 | pool.release(element); 30 | chai_1.assert.equal(pool.acquire(), element); 31 | }); 32 | it('should handle a series of acquisitions and releases', function () { 33 | var element1 = pool.acquire(); 34 | var element2 = pool.acquire(); 35 | pool.release(element1); 36 | chai_1.assert.equal(pool.acquire(), element1); 37 | pool.release(element1); 38 | pool.release(element2); 39 | chai_1.assert.equal(pool.acquire(), element2); 40 | chai_1.assert.equal(pool.acquire(), element1); 41 | }); 42 | it('should throw when releasing an element that was not acquired', function () { 43 | chai_1.assert.throws(function () { return pool.release(document.createElement('span')); }); 44 | }); 45 | }); 46 | 47 | //# sourceMappingURL=DomElementObjectPool.test.js.map 48 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/DomElementObjectPool.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/utils/DomElementObjectPool.test.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAC9B,+DAA8D;AAE9D;IAEE;QADQ,UAAK,GAA4B,EAAE,CAAC;IAC7B,CAAC;IACT,mCAAY,GAAnB,UAAoB,GAAW,IAAY,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAAA,CAAC;IAC9D,mCAAY,GAAnB,UAAoB,GAAW,EAAE,KAAa,IAAU,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IACpF,mBAAC;AAAD,CALA,AAKC,IAAA;AAED,QAAQ,CAAC,sBAAsB,EAAE;IAC/B,IAAI,IAA0B,CAAC;IAE/B,UAAU,CAAC;QACT,IAAI,GAAG,IAAI,2CAAoB,CAAC,MAAM,CAAC,CAAC;QAClC,MAAO,CAAC,QAAQ,GAAG;YACvB,aAAa,EAAE,cAAM,OAAA,IAAI,YAAY,EAAE,EAAlB,CAAkB;SACxC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE;QACrC,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAChC,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAChC,aAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE;QACrC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACtB,aAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE;QACxD,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAChC,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvB,aAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvB,aAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;QACvC,aAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE;QACjE,aAAM,CAAC,MAAM,CAAC,cAAM,OAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,EAA5C,CAA4C,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"DomElementObjectPool.test.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/Generic.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function contains(arr, el) { 4 | return arr.indexOf(el) >= 0; 5 | } 6 | exports.contains = contains; 7 | ; 8 | 9 | //# sourceMappingURL=Generic.js.map 10 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/Generic.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/utils/Generic.ts"],"names":[],"mappings":";;AAWA,kBAAyB,GAAU,EAAE,EAAO;IAC1C,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAFD,4BAEC;AAAA,CAAC","file":"Generic.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/Mouse.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function getCoordsRelativeToElement(event, element) { 4 | if (event.pageX == null) { 5 | return null; 6 | } 7 | var x = event.pageX; 8 | var y = event.pageY; 9 | while (element && element !== self.document.documentElement) { 10 | x -= element.offsetLeft; 11 | y -= element.offsetTop; 12 | element = 'offsetParent' in element ? element.offsetParent : element.parentElement; 13 | } 14 | return [x, y]; 15 | } 16 | exports.getCoordsRelativeToElement = getCoordsRelativeToElement; 17 | function getCoords(event, rowContainer, charMeasure, colCount, rowCount, isSelection) { 18 | if (!charMeasure.width || !charMeasure.height) { 19 | return null; 20 | } 21 | var coords = getCoordsRelativeToElement(event, rowContainer); 22 | if (!coords) { 23 | return null; 24 | } 25 | coords[0] = Math.ceil((coords[0] + (isSelection ? charMeasure.width / 2 : 0)) / charMeasure.width); 26 | coords[1] = Math.ceil(coords[1] / charMeasure.height); 27 | coords[0] = Math.min(Math.max(coords[0], 1), colCount + 1); 28 | coords[1] = Math.min(Math.max(coords[1], 1), rowCount + 1); 29 | return coords; 30 | } 31 | exports.getCoords = getCoords; 32 | function getRawByteCoords(event, rowContainer, charMeasure, colCount, rowCount) { 33 | var coords = getCoords(event, rowContainer, charMeasure, colCount, rowCount); 34 | var x = coords[0]; 35 | var y = coords[1]; 36 | x += 32; 37 | y += 32; 38 | return { x: x, y: y }; 39 | } 40 | exports.getRawByteCoords = getRawByteCoords; 41 | 42 | //# sourceMappingURL=Mouse.js.map 43 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/Mouse.js.map: -------------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W,CAAC,KAAK,CAAC,CAAC;IACnG,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAGtD,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;IAC3D,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;IAE3D,MAAM,CAAC,MAAM,CAAC;AAChB,CAAC;AApBD,8BAoBC;AAYD,0BAAiC,KAAiB,EAAE,YAAyB,EAAE,WAAwB,EAAE,QAAgB,EAAE,QAAgB;IACzI,IAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/E,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAClB,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAGlB,CAAC,IAAI,EAAE,CAAC;IACR,CAAC,IAAI,EAAE,CAAC;IAER,MAAM,CAAC,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,CAAC;AAClB,CAAC;AAVD,4CAUC","file":"Mouse.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/lib/utils/TestUtils.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var MockTerminal = (function () { 4 | function MockTerminal() { 5 | } 6 | MockTerminal.prototype.handler = function (data) { 7 | throw new Error('Method not implemented.'); 8 | }; 9 | MockTerminal.prototype.on = function (event, callback) { 10 | throw new Error('Method not implemented.'); 11 | }; 12 | MockTerminal.prototype.scrollDisp = function (disp, suppressScrollEvent) { 13 | throw new Error('Method not implemented.'); 14 | }; 15 | MockTerminal.prototype.cancel = function (ev, force) { 16 | throw new Error('Method not implemented.'); 17 | }; 18 | MockTerminal.prototype.log = function (text) { 19 | throw new Error('Method not implemented.'); 20 | }; 21 | MockTerminal.prototype.emit = function (event, data) { 22 | throw new Error('Method not implemented.'); 23 | }; 24 | MockTerminal.prototype.reset = function () { 25 | throw new Error('Method not implemented.'); 26 | }; 27 | MockTerminal.prototype.showCursor = function () { 28 | throw new Error('Method not implemented.'); 29 | }; 30 | MockTerminal.prototype.blankLine = function (cur, isWrapped, cols) { 31 | var line = []; 32 | cols = cols || this.cols; 33 | for (var i = 0; i < cols; i++) { 34 | line.push([0, ' ', 1]); 35 | } 36 | return line; 37 | }; 38 | return MockTerminal; 39 | }()); 40 | exports.MockTerminal = MockTerminal; 41 | 42 | //# sourceMappingURL=TestUtils.js.map 43 | -------------------------------------------------------------------------------- /static/xterm/lib/utils/TestUtils.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/utils/TestUtils.ts"],"names":[],"mappings":";;AAEA;IAAA;IAmDA,CAAC;IAhCC,8BAAO,GAAP,UAAQ,IAAY;QAClB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,yBAAE,GAAF,UAAG,KAAa,EAAE,QAAoB;QACpC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,iCAAU,GAAV,UAAW,IAAY,EAAE,mBAA4B;QACnD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,6BAAM,GAAN,UAAO,EAAS,EAAE,KAAe;QAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,0BAAG,GAAH,UAAI,IAAY;QACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,2BAAI,GAAJ,UAAK,KAAa,EAAE,IAAS;QAC3B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,4BAAK,GAAL;QACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,iCAAU,GAAV;QACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,gCAAS,GAAT,UAAU,GAAa,EAAE,SAAmB,EAAE,IAAa;QACzD,IAAM,IAAI,GAAG,EAAE,CAAC;QAChB,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;QACzB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IACH,mBAAC;AAAD,CAnDA,AAmDC,IAAA;AAnDY,oCAAY","file":"TestUtils.js","sourceRoot":".."} -------------------------------------------------------------------------------- /static/xterm/src/BufferSet.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | import { assert } from 'chai'; 5 | import { ITerminal } from './Interfaces'; 6 | import { BufferSet } from './BufferSet'; 7 | import { Buffer } from './Buffer'; 8 | import { MockTerminal } from './utils/TestUtils'; 9 | 10 | describe('BufferSet', () => { 11 | let terminal: ITerminal; 12 | let bufferSet: BufferSet; 13 | 14 | beforeEach(() => { 15 | terminal = new MockTerminal(); 16 | terminal.cols = 80; 17 | terminal.rows = 24; 18 | terminal.scrollback = 1000; 19 | bufferSet = new BufferSet(terminal); 20 | }); 21 | 22 | describe('constructor', () => { 23 | it('should create two different buffers: alt and normal', () => { 24 | assert.instanceOf(bufferSet.normal, Buffer); 25 | assert.instanceOf(bufferSet.alt, Buffer); 26 | assert.notEqual(bufferSet.normal, bufferSet.alt); 27 | }); 28 | }); 29 | 30 | describe('activateNormalBuffer', () => { 31 | beforeEach(() => { 32 | bufferSet.activateNormalBuffer(); 33 | }); 34 | 35 | it('should set the normal buffer as the currently active buffer', () => { 36 | assert.equal(bufferSet.active, bufferSet.normal); 37 | }); 38 | }); 39 | 40 | describe('activateAltBuffer', () => { 41 | beforeEach(() => { 42 | bufferSet.activateAltBuffer(); 43 | }); 44 | 45 | it('should set the alt buffer as the currently active buffer', () => { 46 | assert.equal(bufferSet.active, bufferSet.alt); 47 | }); 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /static/xterm/src/BufferSet.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | import { ITerminal, IBufferSet } from './Interfaces'; 6 | import { Buffer } from './Buffer'; 7 | import { EventEmitter } from './EventEmitter'; 8 | 9 | /** 10 | * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and 11 | * provides also utilities for working with them. 12 | */ 13 | export class BufferSet extends EventEmitter implements IBufferSet { 14 | private _normal: Buffer; 15 | private _alt: Buffer; 16 | private _activeBuffer: Buffer; 17 | 18 | /** 19 | * Create a new BufferSet for the given terminal. 20 | * @param {Terminal} terminal - The terminal the BufferSet will belong to 21 | */ 22 | constructor(private _terminal: ITerminal) { 23 | super(); 24 | this._normal = new Buffer(this._terminal); 25 | this._normal.fillViewportRows(); 26 | this._alt = new Buffer(this._terminal); 27 | this._activeBuffer = this._normal; 28 | } 29 | 30 | /** 31 | * Returns the alt Buffer of the BufferSet 32 | * @returns {Buffer} 33 | */ 34 | public get alt(): Buffer { 35 | return this._alt; 36 | } 37 | 38 | /** 39 | * Returns the normal Buffer of the BufferSet 40 | * @returns {Buffer} 41 | */ 42 | public get active(): Buffer { 43 | return this._activeBuffer; 44 | } 45 | 46 | /** 47 | * Returns the currently active Buffer of the BufferSet 48 | * @returns {Buffer} 49 | */ 50 | public get normal(): Buffer { 51 | return this._normal; 52 | } 53 | 54 | /** 55 | * Sets the normal Buffer of the BufferSet as its currently active Buffer 56 | */ 57 | public activateNormalBuffer(): void { 58 | // The alt buffer should always be cleared when we switch to the normal 59 | // buffer. This frees up memory since the alt buffer should always be new 60 | // when activated. 61 | this._alt.clear(); 62 | 63 | this._activeBuffer = this._normal; 64 | this.emit('activate', this._normal); 65 | } 66 | 67 | /** 68 | * Sets the alt Buffer of the BufferSet as its currently active Buffer 69 | */ 70 | public activateAltBuffer(): void { 71 | // Since the alt buffer is always cleared when the normal buffer is 72 | // activated, we want to fill it when switching to it. 73 | this._alt.fillViewportRows(); 74 | 75 | this._activeBuffer = this._alt; 76 | this.emit('activate', this._alt); 77 | } 78 | 79 | /** 80 | * Resizes both normal and alt buffers, adjusting their data accordingly. 81 | * @param newCols The new number of columns. 82 | * @param newRows The new number of rows. 83 | */ 84 | public resize(newCols: number, newRows: number): void { 85 | this._normal.resize(newCols, newRows); 86 | this._alt.resize(newCols, newRows); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /static/xterm/src/EscapeSequences.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | /** 6 | * C0 control codes 7 | * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes 8 | */ 9 | export namespace C0 { 10 | /** Null (Caret = ^@, C = \0) */ 11 | export const NUL = '\x00'; 12 | /** Start of Heading (Caret = ^A) */ 13 | export const SOH = '\x01'; 14 | /** Start of Text (Caret = ^B) */ 15 | export const STX = '\x02'; 16 | /** End of Text (Caret = ^C) */ 17 | export const ETX = '\x03'; 18 | /** End of Transmission (Caret = ^D) */ 19 | export const EOT = '\x04'; 20 | /** Enquiry (Caret = ^E) */ 21 | export const ENQ = '\x05'; 22 | /** Acknowledge (Caret = ^F) */ 23 | export const ACK = '\x06'; 24 | /** Bell (Caret = ^G, C = \a) */ 25 | export const BEL = '\x07'; 26 | /** Backspace (Caret = ^H, C = \b) */ 27 | export const BS = '\x08'; 28 | /** Character Tabulation, Horizontal Tabulation (Caret = ^I, C = \t) */ 29 | export const HT = '\x09'; 30 | /** Line Feed (Caret = ^J, C = \n) */ 31 | export const LF = '\x0a'; 32 | /** Line Tabulation, Vertical Tabulation (Caret = ^K, C = \v) */ 33 | export const VT = '\x0b'; 34 | /** Form Feed (Caret = ^L, C = \f) */ 35 | export const FF = '\x0c'; 36 | /** Carriage Return (Caret = ^M, C = \r) */ 37 | export const CR = '\x0d'; 38 | /** Shift Out (Caret = ^N) */ 39 | export const SO = '\x0e'; 40 | /** Shift In (Caret = ^O) */ 41 | export const SI = '\x0f'; 42 | /** Data Link Escape (Caret = ^P) */ 43 | export const DLE = '\x10'; 44 | /** Device Control One (XON) (Caret = ^Q) */ 45 | export const DC1 = '\x11'; 46 | /** Device Control Two (Caret = ^R) */ 47 | export const DC2 = '\x12'; 48 | /** Device Control Three (XOFF) (Caret = ^S) */ 49 | export const DC3 = '\x13'; 50 | /** Device Control Four (Caret = ^T) */ 51 | export const DC4 = '\x14'; 52 | /** Negative Acknowledge (Caret = ^U) */ 53 | export const NAK = '\x15'; 54 | /** Synchronous Idle (Caret = ^V) */ 55 | export const SYN = '\x16'; 56 | /** End of Transmission Block (Caret = ^W) */ 57 | export const ETB = '\x17'; 58 | /** Cancel (Caret = ^X) */ 59 | export const CAN = '\x18'; 60 | /** End of Medium (Caret = ^Y) */ 61 | export const EM = '\x19'; 62 | /** Substitute (Caret = ^Z) */ 63 | export const SUB = '\x1a'; 64 | /** Escape (Caret = ^[, C = \e) */ 65 | export const ESC = '\x1b'; 66 | /** File Separator (Caret = ^\) */ 67 | export const FS = '\x1c'; 68 | /** Group Separator (Caret = ^]) */ 69 | export const GS = '\x1d'; 70 | /** Record Separator (Caret = ^^) */ 71 | export const RS = '\x1e'; 72 | /** Unit Separator (Caret = ^_) */ 73 | export const US = '\x1f'; 74 | /** Space */ 75 | export const SP = '\x20'; 76 | /** Delete (Caret = ^?) */ 77 | export const DEL = '\x7f'; 78 | }; 79 | -------------------------------------------------------------------------------- /static/xterm/src/EventEmitter.test.ts: -------------------------------------------------------------------------------- 1 | import { assert } from 'chai'; 2 | import { EventEmitter } from './EventEmitter'; 3 | 4 | describe('EventEmitter', () => { 5 | let eventEmitter: EventEmitter; 6 | 7 | beforeEach(() => { 8 | eventEmitter = new EventEmitter(); 9 | }); 10 | 11 | describe('once', () => { 12 | it('should trigger the listener only once', () => { 13 | let count = 0; 14 | const listener = () => count++; 15 | eventEmitter.once('test', listener); 16 | eventEmitter.emit('test'); 17 | assert.equal(count, 1); 18 | eventEmitter.emit('test'); 19 | assert.equal(count, 1); 20 | }); 21 | }); 22 | 23 | describe('emit', () => { 24 | it('should emit events to listeners', () => { 25 | let count1 = 0; 26 | let count2 = 0; 27 | const listener1 = () => count1++; 28 | const listener2 = () => count2++; 29 | eventEmitter.on('test', listener1); 30 | eventEmitter.on('test', listener2); 31 | eventEmitter.emit('test'); 32 | assert.equal(count1, 1); 33 | assert.equal(count2, 1); 34 | eventEmitter.emit('test'); 35 | assert.equal(count1, 2); 36 | assert.equal(count2, 2); 37 | }); 38 | 39 | it('should manage multiple listener types', () => { 40 | let count1 = 0; 41 | let count2 = 0; 42 | const listener1 = () => count1++; 43 | const listener2 = () => count2++; 44 | eventEmitter.on('test', listener1); 45 | eventEmitter.on('foo', listener2); 46 | eventEmitter.emit('test'); 47 | assert.equal(count1, 1); 48 | assert.equal(count2, 0); 49 | eventEmitter.emit('foo'); 50 | assert.equal(count1, 1); 51 | assert.equal(count2, 1); 52 | }); 53 | }); 54 | 55 | describe('listeners', () => { 56 | it('should return listeners for the type requested', () => { 57 | assert.equal(eventEmitter.listeners('test').length, 0); 58 | const listener = () => {}; 59 | eventEmitter.on('test', listener); 60 | assert.deepEqual(eventEmitter.listeners('test'), [listener]); 61 | }); 62 | }); 63 | 64 | describe('off', () => { 65 | it('should remove the specific listener', () => { 66 | const listener1 = () => {}; 67 | const listener2 = () => {}; 68 | eventEmitter.on('foo', listener1); 69 | eventEmitter.on('foo', listener2); 70 | assert.equal(eventEmitter.listeners('foo').length, 2); 71 | eventEmitter.off('foo', listener1); 72 | assert.deepEqual(eventEmitter.listeners('foo'), [listener2]); 73 | }); 74 | }); 75 | 76 | describe('removeAllListeners', () => { 77 | it('should clear all listeners', () => { 78 | eventEmitter.on('foo', () => {}); 79 | assert.equal(eventEmitter.listeners('foo').length, 1); 80 | eventEmitter.removeAllListeners('foo'); 81 | assert.equal(eventEmitter.listeners('foo').length, 0); 82 | }); 83 | }); 84 | }); 85 | -------------------------------------------------------------------------------- /static/xterm/src/EventEmitter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | import { IEventEmitter } from './Interfaces'; 6 | 7 | interface ListenerType { 8 | (): void; 9 | listener?: () => void; 10 | }; 11 | 12 | export class EventEmitter implements IEventEmitter { 13 | private _events: {[type: string]: ListenerType[]}; 14 | 15 | constructor() { 16 | // Restore the previous events if available, this will happen if the 17 | // constructor is called multiple times on the same object (terminal reset). 18 | this._events = this._events || {}; 19 | } 20 | 21 | public on(type, listener): void { 22 | this._events[type] = this._events[type] || []; 23 | this._events[type].push(listener); 24 | } 25 | 26 | public off(type, listener): void { 27 | if (!this._events[type]) { 28 | return; 29 | } 30 | 31 | let obj = this._events[type]; 32 | let i = obj.length; 33 | 34 | while (i--) { 35 | if (obj[i] === listener || obj[i].listener === listener) { 36 | obj.splice(i, 1); 37 | return; 38 | } 39 | } 40 | } 41 | 42 | public removeAllListeners(type): void { 43 | if (this._events[type]) { 44 | delete this._events[type]; 45 | } 46 | } 47 | 48 | public once(type, listener): any { 49 | function on() { 50 | let args = Array.prototype.slice.call(arguments); 51 | this.off(type, on); 52 | return listener.apply(this, args); 53 | } 54 | (on).listener = listener; 55 | return this.on(type, on); 56 | } 57 | 58 | public emit(type: string, ...args: any[]): void { 59 | if (!this._events[type]) { 60 | return; 61 | } 62 | let obj = this._events[type]; 63 | for (let i = 0; i < obj.length; i++) { 64 | obj[i].apply(this, args); 65 | } 66 | } 67 | 68 | public listeners(type): ListenerType[] { 69 | return this._events[type] || []; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /static/xterm/src/SelectionModel.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | import { ITerminal } from './Interfaces'; 6 | 7 | /** 8 | * Represents a selection within the buffer. This model only cares about column 9 | * and row coordinates, not wide characters. 10 | */ 11 | export class SelectionModel { 12 | /** 13 | * Whether select all is currently active. 14 | */ 15 | public isSelectAllActive: boolean; 16 | 17 | /** 18 | * The [x, y] position the selection starts at. 19 | */ 20 | public selectionStart: [number, number]; 21 | 22 | /** 23 | * The minimal length of the selection from the start position. When double 24 | * clicking on a word, the word will be selected which makes the selection 25 | * start at the start of the word and makes this variable the length. 26 | */ 27 | public selectionStartLength: number; 28 | 29 | /** 30 | * The [x, y] position the selection ends at. 31 | */ 32 | public selectionEnd: [number, number]; 33 | 34 | constructor( 35 | private _terminal: ITerminal 36 | ) { 37 | this.clearSelection(); 38 | } 39 | 40 | /** 41 | * Clears the current selection. 42 | */ 43 | public clearSelection(): void { 44 | this.selectionStart = null; 45 | this.selectionEnd = null; 46 | this.isSelectAllActive = false; 47 | this.selectionStartLength = 0; 48 | } 49 | 50 | /** 51 | * The final selection start, taking into consideration select all. 52 | */ 53 | public get finalSelectionStart(): [number, number] { 54 | if (this.isSelectAllActive) { 55 | return [0, 0]; 56 | } 57 | 58 | if (!this.selectionEnd || !this.selectionStart) { 59 | return this.selectionStart; 60 | } 61 | 62 | return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart; 63 | } 64 | 65 | /** 66 | * The final selection end, taking into consideration select all, double click 67 | * word selection and triple click line selection. 68 | */ 69 | public get finalSelectionEnd(): [number, number] { 70 | if (this.isSelectAllActive) { 71 | return [this._terminal.cols, this._terminal.buffer.ybase + this._terminal.rows - 1]; 72 | } 73 | 74 | if (!this.selectionStart) { 75 | return null; 76 | } 77 | 78 | // Use the selection start if the end doesn't exist or they're reversed 79 | if (!this.selectionEnd || this.areSelectionValuesReversed()) { 80 | return [this.selectionStart[0] + this.selectionStartLength, this.selectionStart[1]]; 81 | } 82 | 83 | // Ensure the the word/line is selected after a double/triple click 84 | if (this.selectionStartLength) { 85 | // Select the larger of the two when start and end are on the same line 86 | if (this.selectionEnd[1] === this.selectionStart[1]) { 87 | return [Math.max(this.selectionStart[0] + this.selectionStartLength, this.selectionEnd[0]), this.selectionEnd[1]]; 88 | } 89 | } 90 | return this.selectionEnd; 91 | } 92 | 93 | /** 94 | * Returns whether the selection start and end are reversed. 95 | */ 96 | public areSelectionValuesReversed(): boolean { 97 | const start = this.selectionStart; 98 | const end = this.selectionEnd; 99 | return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]); 100 | } 101 | 102 | /** 103 | * Handle the buffer being trimmed, adjust the selection position. 104 | * @param amount The amount the buffer is being trimmed. 105 | * @return Whether a refresh is necessary. 106 | */ 107 | public onTrim(amount: number): boolean { 108 | // Adjust the selection position based on the trimmed amount. 109 | if (this.selectionStart) { 110 | this.selectionStart[1] -= amount; 111 | } 112 | if (this.selectionEnd) { 113 | this.selectionEnd[1] -= amount; 114 | } 115 | 116 | // The selection has moved off the buffer, clear it. 117 | if (this.selectionEnd && this.selectionEnd[1] < 0) { 118 | this.clearSelection(); 119 | return true; 120 | } 121 | 122 | // If the selection start is trimmed, ensure the start column is 0. 123 | if (this.selectionStart && this.selectionStart[1] < 0) { 124 | this.selectionStart[1] = 0; 125 | } 126 | return false; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /static/xterm/src/Types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | export type LinkMatcher = { 6 | id: number, 7 | regex: RegExp, 8 | handler: LinkMatcherHandler, 9 | matchIndex?: number, 10 | validationCallback?: LinkMatcherValidationCallback, 11 | priority?: number 12 | }; 13 | export type LinkMatcherHandler = (event: MouseEvent, uri: string) => boolean | void; 14 | export type LinkMatcherValidationCallback = (uri: string, element: HTMLElement, callback: (isValid: boolean) => void) => void; 15 | -------------------------------------------------------------------------------- /static/xterm/src/Viewport.test.ts: -------------------------------------------------------------------------------- 1 | import { assert } from 'chai'; 2 | import { Viewport } from './Viewport'; 3 | import {BufferSet} from './BufferSet'; 4 | 5 | describe('Viewport', () => { 6 | let terminal; 7 | let viewportElement; 8 | let charMeasure; 9 | let viewport; 10 | let scrollAreaElement; 11 | 12 | const CHARACTER_HEIGHT = 10; 13 | 14 | beforeEach(() => { 15 | terminal = { 16 | rows: 0, 17 | ydisp: 0, 18 | on: () => {}, 19 | rowContainer: { 20 | style: { 21 | lineHeight: 0 22 | } 23 | }, 24 | selectionContainer: { 25 | style: { 26 | height: 0 27 | } 28 | }, 29 | scrollback: 10 30 | }; 31 | terminal.buffers = new BufferSet(terminal); 32 | terminal.buffer = terminal.buffers.active; 33 | viewportElement = { 34 | addEventListener: () => {}, 35 | style: { 36 | height: 0, 37 | lineHeight: 0 38 | } 39 | }; 40 | scrollAreaElement = { 41 | style: { 42 | height: 0 43 | } 44 | }; 45 | charMeasure = { 46 | height: CHARACTER_HEIGHT 47 | }; 48 | viewport = new Viewport(terminal, viewportElement, scrollAreaElement, charMeasure); 49 | }); 50 | 51 | describe('refresh', () => { 52 | it('should set the line-height of the terminal', done => { 53 | // Allow CharMeasure to be initialized 54 | setTimeout(() => { 55 | assert.equal(viewportElement.style.lineHeight, CHARACTER_HEIGHT + 'px'); 56 | assert.equal(terminal.rowContainer.style.lineHeight, CHARACTER_HEIGHT + 'px'); 57 | charMeasure.height = 1; 58 | viewport.refresh(); 59 | assert.equal(viewportElement.style.lineHeight, '1px'); 60 | assert.equal(terminal.rowContainer.style.lineHeight, '1px'); 61 | done(); 62 | }, 0); 63 | }); 64 | it('should set the height of the viewport when the line-height changed', () => { 65 | terminal.buffer.lines.push(''); 66 | terminal.buffer.lines.push(''); 67 | terminal.rows = 1; 68 | viewport.refresh(); 69 | assert.equal(viewportElement.style.height, 1 * CHARACTER_HEIGHT + 'px'); 70 | charMeasure.height = 2 * CHARACTER_HEIGHT; 71 | viewport.refresh(); 72 | assert.equal(viewportElement.style.height, 2 * CHARACTER_HEIGHT + 'px'); 73 | }); 74 | }); 75 | 76 | describe('syncScrollArea', () => { 77 | it('should sync the scroll area', done => { 78 | // Allow CharMeasure to be initialized 79 | setTimeout(() => { 80 | terminal.buffer.lines.push(''); 81 | terminal.rows = 1; 82 | assert.equal(scrollAreaElement.style.height, 0 * CHARACTER_HEIGHT + 'px'); 83 | viewport.syncScrollArea(); 84 | assert.equal(viewportElement.style.height, 1 * CHARACTER_HEIGHT + 'px'); 85 | assert.equal(scrollAreaElement.style.height, 1 * CHARACTER_HEIGHT + 'px'); 86 | terminal.buffer.lines.push(''); 87 | viewport.syncScrollArea(); 88 | assert.equal(viewportElement.style.height, 1 * CHARACTER_HEIGHT + 'px'); 89 | assert.equal(scrollAreaElement.style.height, 2 * CHARACTER_HEIGHT + 'px'); 90 | done(); 91 | }, 0); 92 | }); 93 | }); 94 | }); 95 | -------------------------------------------------------------------------------- /static/xterm/src/addons/attach/attach.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implements the attach method, that attaches the terminal to a WebSocket stream. 3 | * @module xterm/addons/attach/attach 4 | * @license MIT 5 | */ 6 | 7 | (function (attach) { 8 | if (typeof exports === 'object' && typeof module === 'object') { 9 | /* 10 | * CommonJS environment 11 | */ 12 | module.exports = attach(require('../../xterm')); 13 | } else if (typeof define == 'function') { 14 | /* 15 | * Require.js is available 16 | */ 17 | define(['../../xterm'], attach); 18 | } else { 19 | /* 20 | * Plain browser environment 21 | */ 22 | attach(window.Terminal); 23 | } 24 | })(function (Xterm) { 25 | 'use strict'; 26 | 27 | var exports = {}; 28 | 29 | /** 30 | * Attaches the given terminal to the given socket. 31 | * 32 | * @param {Xterm} term - The terminal to be attached to the given socket. 33 | * @param {WebSocket} socket - The socket to attach the current terminal. 34 | * @param {boolean} bidirectional - Whether the terminal should send data 35 | * to the socket as well. 36 | * @param {boolean} buffered - Whether the rendering of incoming data 37 | * should happen instantly or at a maximum 38 | * frequency of 1 rendering per 10ms. 39 | */ 40 | exports.attach = function (term, socket, bidirectional, buffered) { 41 | bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional; 42 | term.socket = socket; 43 | 44 | term._flushBuffer = function () { 45 | term.write(term._attachSocketBuffer); 46 | term._attachSocketBuffer = null; 47 | clearTimeout(term._attachSocketBufferTimer); 48 | term._attachSocketBufferTimer = null; 49 | }; 50 | 51 | term._pushToBuffer = function (data) { 52 | if (term._attachSocketBuffer) { 53 | term._attachSocketBuffer += data; 54 | } else { 55 | term._attachSocketBuffer = data; 56 | setTimeout(term._flushBuffer, 10); 57 | } 58 | }; 59 | 60 | term._getMessage = function (ev) { 61 | if (buffered) { 62 | term._pushToBuffer(ev.data); 63 | } else { 64 | term.write(ev.data); 65 | } 66 | }; 67 | 68 | term._sendData = function (data) { 69 | socket.send(data); 70 | }; 71 | 72 | socket.addEventListener('message', term._getMessage); 73 | 74 | if (bidirectional) { 75 | term.on('data', term._sendData); 76 | } 77 | 78 | socket.addEventListener('close', term.detach.bind(term, socket)); 79 | socket.addEventListener('error', term.detach.bind(term, socket)); 80 | }; 81 | 82 | /** 83 | * Detaches the given terminal from the given socket 84 | * 85 | * @param {Xterm} term - The terminal to be detached from the given socket. 86 | * @param {WebSocket} socket - The socket from which to detach the current 87 | * terminal. 88 | */ 89 | exports.detach = function (term, socket) { 90 | term.off('data', term._sendData); 91 | 92 | socket = (typeof socket == 'undefined') ? term.socket : socket; 93 | 94 | if (socket) { 95 | socket.removeEventListener('message', term._getMessage); 96 | } 97 | 98 | delete term.socket; 99 | }; 100 | 101 | /** 102 | * Attaches the current terminal to the given socket 103 | * 104 | * @param {WebSocket} socket - The socket to attach the current terminal. 105 | * @param {boolean} bidirectional - Whether the terminal should send data 106 | * to the socket as well. 107 | * @param {boolean} buffered - Whether the rendering of incoming data 108 | * should happen instantly or at a maximum 109 | * frequency of 1 rendering per 10ms. 110 | */ 111 | Xterm.prototype.attach = function (socket, bidirectional, buffered) { 112 | return exports.attach(this, socket, bidirectional, buffered); 113 | }; 114 | 115 | /** 116 | * Detaches the current terminal from the given socket. 117 | * 118 | * @param {WebSocket} socket - The socket from which to detach the current 119 | * terminal. 120 | */ 121 | Xterm.prototype.detach = function (socket) { 122 | return exports.detach(this, socket); 123 | }; 124 | 125 | return exports; 126 | }); 127 | -------------------------------------------------------------------------------- /static/xterm/src/addons/attach/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.attach", 3 | "main": "attach.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/src/addons/fit/fit.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Fit terminal columns and rows to the dimensions of its DOM element. 3 | * 4 | * ## Approach 5 | * - Rows: Truncate the division of the terminal parent element height by the terminal row height. 6 | * 7 | * - Columns: Truncate the division of the terminal parent element width by the terminal character 8 | * width (apply display: inline at the terminal row and truncate its width with the current 9 | * number of columns). 10 | * @module xterm/addons/fit/fit 11 | * @license MIT 12 | */ 13 | 14 | (function (fit) { 15 | if (typeof exports === 'object' && typeof module === 'object') { 16 | /* 17 | * CommonJS environment 18 | */ 19 | module.exports = fit(require('../../xterm')); 20 | } else if (typeof define == 'function') { 21 | /* 22 | * Require.js is available 23 | */ 24 | define(['../../xterm'], fit); 25 | } else { 26 | /* 27 | * Plain browser environment 28 | */ 29 | fit(window.Terminal); 30 | } 31 | })(function (Xterm) { 32 | var exports = {}; 33 | 34 | exports.proposeGeometry = function (term) { 35 | if (!term.element.parentElement) { 36 | return null; 37 | } 38 | var parentElementStyle = window.getComputedStyle(term.element.parentElement), 39 | parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')), 40 | parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')) - 17), 41 | elementStyle = window.getComputedStyle(term.element), 42 | elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')), 43 | elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')), 44 | availableHeight = parentElementHeight - elementPaddingVer, 45 | availableWidth = parentElementWidth - elementPaddingHor, 46 | container = term.rowContainer, 47 | subjectRow = term.rowContainer.firstElementChild, 48 | contentBuffer = subjectRow.innerHTML, 49 | characterHeight, 50 | rows, 51 | characterWidth, 52 | cols, 53 | geometry; 54 | 55 | subjectRow.style.display = 'inline'; 56 | subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace 57 | characterWidth = subjectRow.getBoundingClientRect().width; 58 | subjectRow.style.display = ''; // Revert style before calculating height, since they differ. 59 | characterHeight = subjectRow.getBoundingClientRect().height; 60 | subjectRow.innerHTML = contentBuffer; 61 | 62 | rows = parseInt(availableHeight / characterHeight); 63 | cols = parseInt(availableWidth / characterWidth); 64 | 65 | geometry = {cols: cols, rows: rows}; 66 | return geometry; 67 | }; 68 | 69 | exports.fit = function (term) { 70 | var geometry = exports.proposeGeometry(term); 71 | 72 | if (geometry) { 73 | term.resize(geometry.cols, geometry.rows); 74 | } 75 | }; 76 | 77 | Xterm.prototype.proposeGeometry = function () { 78 | return exports.proposeGeometry(this); 79 | }; 80 | 81 | Xterm.prototype.fit = function () { 82 | return exports.fit(this); 83 | }; 84 | 85 | return exports; 86 | }); 87 | -------------------------------------------------------------------------------- /static/xterm/src/addons/fit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.fit", 3 | "main": "fit.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/src/addons/fullscreen/fullscreen.css: -------------------------------------------------------------------------------- 1 | .xterm.fullscreen { 2 | position: fixed; 3 | top: 0; 4 | bottom: 0; 5 | left: 0; 6 | right: 0; 7 | width: auto; 8 | height: auto; 9 | z-index: 255; 10 | } 11 | -------------------------------------------------------------------------------- /static/xterm/src/addons/fullscreen/fullscreen.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Fullscreen addon for xterm.js 3 | * @module xterm/addons/fullscreen/fullscreen 4 | * @license MIT 5 | */ 6 | (function (fullscreen) { 7 | if (typeof exports === 'object' && typeof module === 'object') { 8 | /* 9 | * CommonJS environment 10 | */ 11 | module.exports = fullscreen(require('../../xterm')); 12 | } else if (typeof define == 'function') { 13 | /* 14 | * Require.js is available 15 | */ 16 | define(['../../xterm'], fullscreen); 17 | } else { 18 | /* 19 | * Plain browser environment 20 | */ 21 | fullscreen(window.Terminal); 22 | } 23 | })(function (Xterm) { 24 | var exports = {}; 25 | 26 | /** 27 | * Toggle the given terminal's fullscreen mode. 28 | * @param {Xterm} term - The terminal to toggle full screen mode 29 | * @param {boolean} fullscreen - Toggle fullscreen on (true) or off (false) 30 | */ 31 | exports.toggleFullScreen = function (term, fullscreen) { 32 | var fn; 33 | 34 | if (typeof fullscreen == 'undefined') { 35 | fn = (term.element.classList.contains('fullscreen')) ? 'remove' : 'add'; 36 | } else if (!fullscreen) { 37 | fn = 'remove'; 38 | } else { 39 | fn = 'add'; 40 | } 41 | 42 | term.element.classList[fn]('fullscreen'); 43 | }; 44 | 45 | Xterm.prototype.toggleFullscreen = function (fullscreen) { 46 | exports.toggleFullScreen(this, fullscreen); 47 | }; 48 | 49 | return exports; 50 | }); 51 | -------------------------------------------------------------------------------- /static/xterm/src/addons/fullscreen/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.fullscreen", 3 | "main": "fullscreen.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/src/addons/search/SearchHelper.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | // import { ITerminal } from '../../Interfaces'; 6 | // import { translateBufferLineToString } from '../../utils/BufferLine'; 7 | 8 | interface ISearchResult { 9 | term: string; 10 | col: number; 11 | row: number; 12 | } 13 | 14 | /** 15 | * A class that knows how to search the terminal and how to display the results. 16 | */ 17 | export class SearchHelper { 18 | constructor(private _terminal: any, private _translateBufferLineToString: any) { 19 | // TODO: Search for multiple instances on 1 line 20 | // TODO: Don't use the actual selection, instead use a "find selection" so multiple instances can be highlighted 21 | // TODO: Highlight other instances in the viewport 22 | // TODO: Support regex, case sensitivity, etc. 23 | } 24 | 25 | /** 26 | * Find the next instance of the term, then scroll to and select it. If it 27 | * doesn't exist, do nothing. 28 | * @param term Tne search term. 29 | * @return Whether a result was found. 30 | */ 31 | public findNext(term: string): boolean { 32 | if (!term || term.length === 0) { 33 | return false; 34 | } 35 | 36 | let result: ISearchResult; 37 | 38 | let startRow = this._terminal.buffer.ydisp; 39 | if (this._terminal.selectionManager.selectionEnd) { 40 | // Start from the selection end if there is a selection 41 | startRow = this._terminal.selectionManager.selectionEnd[1]; 42 | } 43 | 44 | // Search from ydisp + 1 to end 45 | for (let y = startRow + 1; y < this._terminal.buffer.ybase + this._terminal.rows; y++) { 46 | result = this._findInLine(term, y); 47 | if (result) { 48 | break; 49 | } 50 | } 51 | 52 | // Search from the top to the current ydisp 53 | if (!result) { 54 | for (let y = 0; y < startRow; y++) { 55 | result = this._findInLine(term, y); 56 | if (result) { 57 | break; 58 | } 59 | } 60 | } 61 | 62 | // Set selection and scroll if a result was found 63 | return this._selectResult(result); 64 | } 65 | 66 | /** 67 | * Find the previous instance of the term, then scroll to and select it. If it 68 | * doesn't exist, do nothing. 69 | * @param term Tne search term. 70 | * @return Whether a result was found. 71 | */ 72 | public findPrevious(term: string): boolean { 73 | if (!term || term.length === 0) { 74 | return false; 75 | } 76 | 77 | let result: ISearchResult; 78 | 79 | let startRow = this._terminal.buffer.ydisp; 80 | if (this._terminal.selectionManager.selectionStart) { 81 | // Start from the selection end if there is a selection 82 | startRow = this._terminal.selectionManager.selectionStart[1]; 83 | } 84 | 85 | // Search from ydisp + 1 to end 86 | for (let y = startRow - 1; y >= 0; y--) { 87 | result = this._findInLine(term, y); 88 | if (result) { 89 | break; 90 | } 91 | } 92 | 93 | // Search from the top to the current ydisp 94 | if (!result) { 95 | for (let y = this._terminal.buffer.ybase + this._terminal.rows - 1; y > startRow; y--) { 96 | result = this._findInLine(term, y); 97 | if (result) { 98 | break; 99 | } 100 | } 101 | } 102 | 103 | // Set selection and scroll if a result was found 104 | return this._selectResult(result); 105 | } 106 | 107 | /** 108 | * Searches a line for a search term. 109 | * @param term Tne search term. 110 | * @param y The line to search. 111 | * @return The search result if it was found. 112 | */ 113 | private _findInLine(term: string, y: number): ISearchResult { 114 | const bufferLine = this._terminal.buffer.lines.get(y); 115 | const lowerStringLine = this._translateBufferLineToString(bufferLine, true).toLowerCase(); 116 | const lowerTerm = term.toLowerCase(); 117 | const searchIndex = lowerStringLine.indexOf(lowerTerm); 118 | if (searchIndex >= 0) { 119 | return { 120 | term, 121 | col: searchIndex, 122 | row: y 123 | }; 124 | } 125 | } 126 | 127 | /** 128 | * Selects and scrolls to a result. 129 | * @param result The result to select. 130 | * @return Whethera result was selected. 131 | */ 132 | private _selectResult(result: ISearchResult): boolean { 133 | if (!result) { 134 | return false; 135 | } 136 | this._terminal.selectionManager.setSelection(result.col, result.row, result.term.length); 137 | this._terminal.scrollDisp(result.row - this._terminal.buffer.ydisp, false); 138 | return true; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /static/xterm/src/addons/search/search.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | import { SearchHelper } from './SearchHelper'; 6 | 7 | declare var exports: any; 8 | declare var module: any; 9 | declare var define: any; 10 | declare var require: any; 11 | declare var window: any; 12 | 13 | (function (addon) { 14 | if ('Terminal' in window) { 15 | /** 16 | * Plain browser environment 17 | */ 18 | addon(window.Terminal); 19 | } else if (typeof exports === 'object' && typeof module === 'object') { 20 | /** 21 | * CommonJS environment 22 | */ 23 | module.exports = addon(require('../../xterm')); 24 | } else if (typeof define == 'function') { 25 | /** 26 | * Require.js is available 27 | */ 28 | define(['../../xterm'], addon); 29 | } 30 | })((Terminal: any) => { 31 | /** 32 | * Find the next instance of the term, then scroll to and select it. If it 33 | * doesn't exist, do nothing. 34 | * @param term Tne search term. 35 | * @return Whether a result was found. 36 | */ 37 | Terminal.prototype.findNext = function(term: string): boolean { 38 | if (!this._searchHelper) { 39 | this.searchHelper = new SearchHelper(this, Terminal.translateBufferLineToString); 40 | } 41 | return (this.searchHelper).findNext(term); 42 | }; 43 | 44 | /** 45 | * Find the previous instance of the term, then scroll to and select it. If it 46 | * doesn't exist, do nothing. 47 | * @param term Tne search term. 48 | * @return Whether a result was found. 49 | */ 50 | Terminal.prototype.findPrevious = function(term: string): boolean { 51 | if (!this._searchHelper) { 52 | this.searchHelper = new SearchHelper(this, Terminal.translateBufferLineToString); 53 | } 54 | return (this.searchHelper).findPrevious(term); 55 | }; 56 | }); 57 | -------------------------------------------------------------------------------- /static/xterm/src/addons/search/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "rootDir": ".", 6 | "outDir": "../../../lib/addons/search/", 7 | "sourceMap": true, 8 | "removeComments": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /static/xterm/src/addons/terminado/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm.terminado", 3 | "main": "terminado.js", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /static/xterm/src/handlers/Clipboard.test.ts: -------------------------------------------------------------------------------- 1 | import { assert } from 'chai'; 2 | import * as Terminal from '../xterm'; 3 | import * as Clipboard from './Clipboard'; 4 | 5 | describe('evaluatePastedTextProcessing', function () { 6 | it('should replace carriage return + line feed with line feed on windows', function () { 7 | const pastedText = 'foo\r\nbar\r\n', 8 | processedText = Clipboard.prepareTextForTerminal(pastedText, false), 9 | windowsProcessedText = Clipboard.prepareTextForTerminal(pastedText, true); 10 | 11 | assert.equal(processedText, 'foo\r\nbar\r\n'); 12 | assert.equal(windowsProcessedText, 'foo\rbar\r'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /static/xterm/src/handlers/Clipboard.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Clipboard handler module: exports methods for handling all clipboard-related events in the 3 | * terminal. 4 | * @module xterm/handlers/Clipboard 5 | * @license MIT 6 | */ 7 | 8 | import { ITerminal, ISelectionManager } from '../Interfaces'; 9 | 10 | interface IWindow extends Window { 11 | clipboardData?: { 12 | getData(format: string): string; 13 | setData(format: string, data: string); 14 | }; 15 | } 16 | 17 | declare var window: IWindow; 18 | 19 | /** 20 | * Prepares text to be pasted into the terminal by normalizing the line endings 21 | * @param text The pasted text that needs processing before inserting into the terminal 22 | */ 23 | export function prepareTextForTerminal(text: string, isMSWindows: boolean): string { 24 | if (isMSWindows) { 25 | return text.replace(/\r?\n/g, '\r'); 26 | } 27 | return text; 28 | } 29 | 30 | /** 31 | * Binds copy functionality to the given terminal. 32 | * @param {ClipboardEvent} ev The original copy event to be handled 33 | */ 34 | export function copyHandler(ev: ClipboardEvent, term: ITerminal, selectionManager: ISelectionManager) { 35 | if (term.browser.isMSIE) { 36 | window.clipboardData.setData('Text', selectionManager.selectionText); 37 | } else { 38 | ev.clipboardData.setData('text/plain', selectionManager.selectionText); 39 | } 40 | 41 | // Prevent or the original text will be copied. 42 | ev.preventDefault(); 43 | } 44 | 45 | /** 46 | * Redirect the clipboard's data to the terminal's input handler. 47 | * @param {ClipboardEvent} ev The original paste event to be handled 48 | * @param {Terminal} term The terminal on which to apply the handled paste event 49 | */ 50 | export function pasteHandler(ev: ClipboardEvent, term: ITerminal) { 51 | ev.stopPropagation(); 52 | 53 | let text: string; 54 | 55 | let dispatchPaste = function(text) { 56 | text = prepareTextForTerminal(text, term.browser.isMSWindows); 57 | term.handler(text); 58 | term.textarea.value = ''; 59 | term.emit('paste', text); 60 | 61 | return term.cancel(ev); 62 | }; 63 | 64 | if (term.browser.isMSIE) { 65 | if (window.clipboardData) { 66 | text = window.clipboardData.getData('Text'); 67 | dispatchPaste(text); 68 | } 69 | } else { 70 | if (ev.clipboardData) { 71 | text = ev.clipboardData.getData('text/plain'); 72 | dispatchPaste(text); 73 | } 74 | } 75 | } 76 | 77 | /** 78 | * Moves the textarea under the mouse cursor and focuses it. 79 | * @param ev The original right click event to be handled. 80 | * @param textarea The terminal's textarea. 81 | */ 82 | export function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextAreaElement) { 83 | // Bring textarea at the cursor position 84 | textarea.style.position = 'fixed'; 85 | textarea.style.width = '20px'; 86 | textarea.style.height = '20px'; 87 | textarea.style.left = (ev.clientX - 10) + 'px'; 88 | textarea.style.top = (ev.clientY - 10) + 'px'; 89 | textarea.style.zIndex = '1000'; 90 | 91 | textarea.focus(); 92 | 93 | // Reset the terminal textarea's styling 94 | setTimeout(function () { 95 | textarea.style.position = null; 96 | textarea.style.width = null; 97 | textarea.style.height = null; 98 | textarea.style.left = null; 99 | textarea.style.top = null; 100 | textarea.style.zIndex = null; 101 | }, 4); 102 | } 103 | 104 | /** 105 | * Bind to right-click event and allow right-click copy and paste. 106 | * @param ev The original right click event to be handled. 107 | * @param textarea The terminal's textarea. 108 | * @param selectionManager The terminal's selection manager. 109 | */ 110 | export function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, selectionManager: ISelectionManager) { 111 | moveTextAreaUnderMouseCursor(ev, textarea); 112 | 113 | // Get textarea ready to copy from the context menu 114 | textarea.value = selectionManager.selectionText; 115 | textarea.select(); 116 | } 117 | -------------------------------------------------------------------------------- /static/xterm/src/test/addons/test.js: -------------------------------------------------------------------------------- 1 | var assert = require('chai').assert; 2 | var Terminal = require('../../xterm'); 3 | 4 | describe('xterm.js addons', function() { 5 | it('should load addons with Terminal.loadAddon', function () { 6 | Terminal.loadAddon('attach'); 7 | // Test that addon was loaded successfully 8 | assert.equal(typeof Terminal.prototype.attach, 'function'); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /static/xterm/src/utils/Browser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Attributes and methods to help with identifying the current browser and platform. 3 | * @module xterm/utils/Browser 4 | * @license MIT 5 | */ 6 | 7 | import { contains } from './Generic'; 8 | 9 | const isNode = (typeof navigator === 'undefined') ? true : false; 10 | const userAgent = (isNode) ? 'node' : navigator.userAgent; 11 | const platform = (isNode) ? 'node' : navigator.platform; 12 | 13 | export const isFirefox = !!~userAgent.indexOf('Firefox'); 14 | export const isMSIE = !!~userAgent.indexOf('MSIE') || !!~userAgent.indexOf('Trident'); 15 | 16 | // Find the users platform. We use this to interpret the meta key 17 | // and ISO third level shifts. 18 | // http://stackoverflow.com/q/19877924/577598 19 | export const isMac = contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform); 20 | export const isIpad = platform === 'iPad'; 21 | export const isIphone = platform === 'iPhone'; 22 | export const isMSWindows = contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform); 23 | export const isLinux = platform.indexOf('Linux') >= 0; 24 | -------------------------------------------------------------------------------- /static/xterm/src/utils/BufferLine.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | // TODO: This module should be merged into a buffer or buffer line class 6 | 7 | const LINE_DATA_CHAR_INDEX = 1; 8 | const LINE_DATA_WIDTH_INDEX = 2; 9 | 10 | /** 11 | * Translates a buffer line to a string, with optional start and end columns. 12 | * Wide characters will count as two columns in the resulting string. This 13 | * function is useful for getting the actual text underneath the raw selection 14 | * position. 15 | * @param line The line being translated. 16 | * @param trimRight Whether to trim whitespace to the right. 17 | * @param startCol The column to start at. 18 | * @param endCol The column to end at. 19 | */ 20 | export function translateBufferLineToString(line: any, trimRight: boolean, startCol: number = 0, endCol: number = null): string { 21 | // Get full line 22 | let lineString = ''; 23 | let widthAdjustedStartCol = startCol; 24 | let widthAdjustedEndCol = endCol; 25 | for (let i = 0; i < line.length; i++) { 26 | const char = line[i]; 27 | lineString += char[LINE_DATA_CHAR_INDEX]; 28 | // Adjust start and end cols for wide characters if they affect their 29 | // column indexes 30 | if (char[LINE_DATA_WIDTH_INDEX] === 0) { 31 | if (startCol >= i) { 32 | widthAdjustedStartCol--; 33 | } 34 | if (endCol >= i) { 35 | widthAdjustedEndCol--; 36 | } 37 | } 38 | } 39 | 40 | // Calculate the final end col by trimming whitespace on the right of the 41 | // line if needed. 42 | let finalEndCol = widthAdjustedEndCol || line.length; 43 | if (trimRight) { 44 | const rightWhitespaceIndex = lineString.search(/\s+$/); 45 | if (rightWhitespaceIndex !== -1) { 46 | finalEndCol = Math.min(finalEndCol, rightWhitespaceIndex); 47 | } 48 | // Return the empty string if only trimmed whitespace is selected 49 | if (finalEndCol <= widthAdjustedStartCol) { 50 | return ''; 51 | } 52 | } 53 | 54 | return lineString.substring(widthAdjustedStartCol, finalEndCol); 55 | } 56 | -------------------------------------------------------------------------------- /static/xterm/src/utils/CharMeasure.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | import jsdom = require('jsdom'); 5 | import { assert } from 'chai'; 6 | import { ICharMeasure, ITerminal } from '../Interfaces'; 7 | import { CharMeasure } from './CharMeasure'; 8 | 9 | describe('CharMeasure', () => { 10 | let dom: jsdom.JSDOM; 11 | let window: Window; 12 | let document: Document; 13 | let container: HTMLElement; 14 | let charMeasure: ICharMeasure; 15 | 16 | beforeEach(() => { 17 | dom = new jsdom.JSDOM(''); 18 | window = dom.window; 19 | document = window.document; 20 | container = document.createElement('div'); 21 | document.body.appendChild(container); 22 | charMeasure = new CharMeasure(document, container); 23 | }); 24 | 25 | describe('measure', () => { 26 | it('should set _measureElement on first call', () => { 27 | charMeasure.measure(); 28 | assert.isDefined((charMeasure)._measureElement, 'CharMeasure.measure should have created _measureElement'); 29 | }); 30 | 31 | it('should be performed async on first call', done => { 32 | assert.equal(charMeasure.width, null); 33 | charMeasure.measure(); 34 | // Mock getBoundingClientRect since jsdom doesn't have a layout engine 35 | (charMeasure)._measureElement.getBoundingClientRect = () => { 36 | return { width: 1, height: 1 }; 37 | }; 38 | assert.equal(charMeasure.width, null); 39 | setTimeout(() => { 40 | assert.equal(charMeasure.width, 1); 41 | done(); 42 | }, 0); 43 | }); 44 | 45 | it('should be performed sync on successive calls', done => { 46 | charMeasure.measure(); 47 | // Mock getBoundingClientRect since jsdom doesn't have a layout engine 48 | (charMeasure)._measureElement.getBoundingClientRect = () => { 49 | return { width: 1, height: 1 }; 50 | }; 51 | setTimeout(() => { 52 | const firstWidth = charMeasure.width; 53 | // Mock getBoundingClientRect since jsdom doesn't have a layout engine 54 | (charMeasure)._measureElement.getBoundingClientRect = () => { 55 | return { width: 2, height: 2 }; 56 | }; 57 | charMeasure.measure(); 58 | assert.equal(charMeasure.width, firstWidth * 2); 59 | done(); 60 | }, 0); 61 | }); 62 | 63 | it('should NOT do a measure when the parent is hidden', done => { 64 | charMeasure.measure(); 65 | setTimeout(() => { 66 | const firstWidth = charMeasure.width; 67 | container.style.display = 'none'; 68 | container.style.fontSize = '2em'; 69 | charMeasure.measure(); 70 | assert.equal(charMeasure.width, firstWidth); 71 | done(); 72 | }, 0); 73 | }); 74 | }); 75 | }); 76 | -------------------------------------------------------------------------------- /static/xterm/src/utils/CharMeasure.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module xterm/utils/CharMeasure 3 | * @license MIT 4 | */ 5 | 6 | import { EventEmitter } from '../EventEmitter.js'; 7 | 8 | /** 9 | * Utility class that measures the size of a character. 10 | */ 11 | export class CharMeasure extends EventEmitter { 12 | private _document: Document; 13 | private _parentElement: HTMLElement; 14 | private _measureElement: HTMLElement; 15 | private _width: number; 16 | private _height: number; 17 | 18 | constructor(document: Document, parentElement: HTMLElement) { 19 | super(); 20 | this._document = document; 21 | this._parentElement = parentElement; 22 | } 23 | 24 | public get width(): number { 25 | return this._width; 26 | } 27 | 28 | public get height(): number { 29 | return this._height; 30 | } 31 | 32 | public measure(): void { 33 | if (!this._measureElement) { 34 | this._measureElement = this._document.createElement('span'); 35 | this._measureElement.style.position = 'absolute'; 36 | this._measureElement.style.top = '0'; 37 | this._measureElement.style.left = '-9999em'; 38 | this._measureElement.textContent = 'W'; 39 | this._measureElement.setAttribute('aria-hidden', 'true'); 40 | this._parentElement.appendChild(this._measureElement); 41 | // Perform _doMeasure async if the element was just attached as sometimes 42 | // getBoundingClientRect does not return accurate values without this. 43 | setTimeout(() => this._doMeasure(), 0); 44 | } else { 45 | this._doMeasure(); 46 | } 47 | } 48 | 49 | private _doMeasure(): void { 50 | const geometry = this._measureElement.getBoundingClientRect(); 51 | // The element is likely currently display:none, we should retain the 52 | // previous value. 53 | if (geometry.width === 0 || geometry.height === 0) { 54 | return; 55 | } 56 | if (this._width !== geometry.width || this._height !== geometry.height) { 57 | this._width = geometry.width; 58 | this._height = geometry.height; 59 | this.emit('charsizechanged'); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /static/xterm/src/utils/DomElementObjectPool.test.ts: -------------------------------------------------------------------------------- 1 | import { assert } from 'chai'; 2 | import { DomElementObjectPool } from './DomElementObjectPool'; 3 | 4 | class MockDocument { 5 | private _attr: {[key: string]: string} = {}; 6 | constructor() {} 7 | public getAttribute(key: string): string { return this._attr[key]; }; 8 | public setAttribute(key: string, value: string): void { this._attr[key] = value; } 9 | } 10 | 11 | describe('DomElementObjectPool', () => { 12 | let pool: DomElementObjectPool; 13 | 14 | beforeEach(() => { 15 | pool = new DomElementObjectPool('span'); 16 | (global).document = { 17 | createElement: () => new MockDocument() 18 | }; 19 | }); 20 | 21 | it('should acquire distinct elements', () => { 22 | const element1 = pool.acquire(); 23 | const element2 = pool.acquire(); 24 | assert.notEqual(element1, element2); 25 | }); 26 | 27 | it('should acquire released elements', () => { 28 | const element = pool.acquire(); 29 | pool.release(element); 30 | assert.equal(pool.acquire(), element); 31 | }); 32 | 33 | it('should handle a series of acquisitions and releases', () => { 34 | const element1 = pool.acquire(); 35 | const element2 = pool.acquire(); 36 | pool.release(element1); 37 | assert.equal(pool.acquire(), element1); 38 | pool.release(element1); 39 | pool.release(element2); 40 | assert.equal(pool.acquire(), element2); 41 | assert.equal(pool.acquire(), element1); 42 | }); 43 | 44 | it('should throw when releasing an element that was not acquired', () => { 45 | assert.throws(() => pool.release(document.createElement('span'))); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /static/xterm/src/utils/DomElementObjectPool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @module xterm/utils/DomElementObjectPool 3 | * @license MIT 4 | */ 5 | 6 | /** 7 | * An object pool that manages acquisition and releasing of DOM elements for 8 | * when reuse is desirable. 9 | */ 10 | export class DomElementObjectPool { 11 | private static readonly OBJECT_ID_ATTRIBUTE = 'data-obj-id'; 12 | 13 | private static _objectCount = 0; 14 | 15 | private _type: string; 16 | private _pool: HTMLElement[]; 17 | private _inUse: {[key: string]: HTMLElement}; 18 | 19 | /** 20 | * @param type The DOM element type (div, span, etc.). 21 | */ 22 | constructor(private type: string) { 23 | this._type = type; 24 | this._pool = []; 25 | this._inUse = {}; 26 | } 27 | 28 | /** 29 | * Acquire an element from the pool, creating it if the pool is empty. 30 | */ 31 | public acquire(): HTMLElement { 32 | let element: HTMLElement; 33 | if (this._pool.length === 0) { 34 | element = this._createNew(); 35 | } else { 36 | element = this._pool.pop(); 37 | } 38 | this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)] = element; 39 | return element; 40 | } 41 | 42 | /** 43 | * Release an element back into the pool. It's up to the caller of this 44 | * function to ensure that all external references to the element have been 45 | * removed. 46 | * @param element The element being released. 47 | */ 48 | public release(element: HTMLElement): void { 49 | if (!this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)]) { 50 | throw new Error('Could not release an element not yet acquired'); 51 | } 52 | delete this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)]; 53 | this._cleanElement(element); 54 | this._pool.push(element); 55 | } 56 | 57 | /** 58 | * Creates a new element for the pool. 59 | */ 60 | private _createNew(): HTMLElement { 61 | const element = document.createElement(this._type); 62 | const id = DomElementObjectPool._objectCount++; 63 | element.setAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE, id.toString(10)); 64 | return element; 65 | } 66 | 67 | /** 68 | * Resets an element back to a "clean state". 69 | * @param element The element to be cleaned. 70 | */ 71 | private _cleanElement(element: HTMLElement): void { 72 | element.className = ''; 73 | element.innerHTML = ''; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /static/xterm/src/utils/Generic.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Generic utilities module with methods that can be helpful at different parts of the code base. 3 | * @module xterm/utils/Generic 4 | * @license MIT 5 | */ 6 | 7 | /** 8 | * Return if the given array contains the given element 9 | * @param {Array} array The array to search for the given element. 10 | * @param {Object} el The element to look for into the array 11 | */ 12 | export function contains(arr: any[], el: any) { 13 | return arr.indexOf(el) >= 0; 14 | }; 15 | -------------------------------------------------------------------------------- /static/xterm/src/utils/Mouse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license MIT 3 | */ 4 | 5 | import { CharMeasure } from './CharMeasure'; 6 | 7 | export function getCoordsRelativeToElement(event: MouseEvent, element: HTMLElement): [number, number] { 8 | // Ignore browsers that don't support MouseEvent.pageX 9 | if (event.pageX == null) { 10 | return null; 11 | } 12 | 13 | let x = event.pageX; 14 | let y = event.pageY; 15 | 16 | // Converts the coordinates from being relative to the document to being 17 | // relative to the terminal. 18 | while (element && element !== self.document.documentElement) { 19 | x -= element.offsetLeft; 20 | y -= element.offsetTop; 21 | element = 'offsetParent' in element ? element.offsetParent : element.parentElement; 22 | } 23 | return [x, y]; 24 | } 25 | 26 | /** 27 | * Gets coordinates within the terminal for a particular mouse event. The result 28 | * is returned as an array in the form [x, y] instead of an object as it's a 29 | * little faster and this function is used in some low level code. 30 | * @param event The mouse event. 31 | * @param rowContainer The terminal's row container. 32 | * @param charMeasure The char measure object used to determine character sizes. 33 | * @param colCount The number of columns in the terminal. 34 | * @param rowCount The number of rows n the terminal. 35 | * @param isSelection Whether the request is for the selection or not. This will 36 | * apply an offset to the x value such that the left half of the cell will 37 | * select that cell and the right half will select the next cell. 38 | */ 39 | export function getCoords(event: MouseEvent, rowContainer: HTMLElement, charMeasure: CharMeasure, colCount: number, rowCount: number, isSelection?: boolean): [number, number] { 40 | // Coordinates cannot be measured if charMeasure has not been initialized 41 | if (!charMeasure.width || !charMeasure.height) { 42 | return null; 43 | } 44 | 45 | const coords = getCoordsRelativeToElement(event, rowContainer); 46 | if (!coords) { 47 | return null; 48 | } 49 | 50 | // Convert to cols/rows. 51 | coords[0] = Math.ceil((coords[0] + (isSelection ? charMeasure.width / 2 : 0)) / charMeasure.width); 52 | coords[1] = Math.ceil(coords[1] / charMeasure.height); 53 | 54 | // Ensure coordinates are within the terminal viewport. 55 | coords[0] = Math.min(Math.max(coords[0], 1), colCount + 1); 56 | coords[1] = Math.min(Math.max(coords[1], 1), rowCount + 1); 57 | 58 | return coords; 59 | } 60 | 61 | /** 62 | * Gets coordinates within the terminal for a particular mouse event, wrapping 63 | * them to the bounds of the terminal and adding 32 to both the x and y values 64 | * as expected by xterm. 65 | * @param event The mouse event. 66 | * @param rowContainer The terminal's row container. 67 | * @param charMeasure The char measure object used to determine character sizes. 68 | * @param colCount The number of columns in the terminal. 69 | * @param rowCount The number of rows in the terminal. 70 | */ 71 | export function getRawByteCoords(event: MouseEvent, rowContainer: HTMLElement, charMeasure: CharMeasure, colCount: number, rowCount: number): { x: number, y: number } { 72 | const coords = getCoords(event, rowContainer, charMeasure, colCount, rowCount); 73 | let x = coords[0]; 74 | let y = coords[1]; 75 | 76 | // xterm sends raw bytes and starts at 32 (SP) for each. 77 | x += 32; 78 | y += 32; 79 | 80 | return { x, y }; 81 | } 82 | -------------------------------------------------------------------------------- /static/xterm/src/utils/TestUtils.ts: -------------------------------------------------------------------------------- 1 | import { ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager } from '../Interfaces'; 2 | 3 | export class MockTerminal implements ITerminal { 4 | public element: HTMLElement; 5 | public rowContainer: HTMLElement; 6 | public selectionContainer: HTMLElement; 7 | public selectionManager: ISelectionManager; 8 | public charMeasure: ICharMeasure; 9 | public textarea: HTMLTextAreaElement; 10 | public rows: number; 11 | public cols: number; 12 | public browser: IBrowser; 13 | public writeBuffer: string[]; 14 | public children: HTMLElement[]; 15 | public cursorHidden: boolean; 16 | public cursorState: number; 17 | public defAttr: number; 18 | public scrollback: number; 19 | public buffers: IBufferSet; 20 | public buffer: IBuffer; 21 | 22 | handler(data: string) { 23 | throw new Error('Method not implemented.'); 24 | } 25 | on(event: string, callback: () => void) { 26 | throw new Error('Method not implemented.'); 27 | } 28 | scrollDisp(disp: number, suppressScrollEvent: boolean) { 29 | throw new Error('Method not implemented.'); 30 | } 31 | cancel(ev: Event, force?: boolean) { 32 | throw new Error('Method not implemented.'); 33 | } 34 | log(text: string): void { 35 | throw new Error('Method not implemented.'); 36 | } 37 | emit(event: string, data: any) { 38 | throw new Error('Method not implemented.'); 39 | } 40 | reset(): void { 41 | throw new Error('Method not implemented.'); 42 | } 43 | showCursor(): void { 44 | throw new Error('Method not implemented.'); 45 | } 46 | blankLine(cur?: boolean, isWrapped?: boolean, cols?: number) { 47 | const line = []; 48 | cols = cols || this.cols; 49 | for (let i = 0; i < cols; i++) { 50 | line.push([0, ' ', 1]); 51 | } 52 | return line; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /static/xterm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "rootDir": "src", 6 | "allowJs": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "removeComments": true 10 | }, 11 | "include": [ 12 | "src/**/*" 13 | ], 14 | "exclude": [ 15 | "src/addons/**/*" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /static/xterm/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "class-name": true, 4 | "comment-format": [ 5 | true, 6 | "check-space" 7 | ], 8 | "indent": [ 9 | true, 10 | "spaces" 11 | ], 12 | "eofline": true, 13 | "no-eval": true, 14 | "no-internal-module": true, 15 | "no-trailing-whitespace": true, 16 | "no-unsafe-finally": true, 17 | "no-var-keyword": true, 18 | "quotemark": [ 19 | true, 20 | "single" 21 | ], 22 | "semicolon": [ 23 | true, 24 | "always" 25 | ], 26 | "triple-equals": [ 27 | true, 28 | "allow-null-check" 29 | ], 30 | "typedef-whitespace": [ 31 | true, 32 | { 33 | "call-signature": "nospace", 34 | "index-signature": "nospace", 35 | "parameter": "nospace", 36 | "property-declaration": "nospace", 37 | "variable-declaration": "nospace" 38 | } 39 | ], 40 | "variable-name": [ 41 | true, 42 | "ban-keywords" 43 | ], 44 | "whitespace": [ 45 | true, 46 | "check-branch", 47 | "check-decl", 48 | "check-operator", 49 | "check-separator", 50 | "check-type" 51 | ] 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /static/xterm/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xterm", 3 | "globalDependencies": { 4 | "node": "registry:env/node#6.0.0+20160918225031" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Home Page 6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 | 14 |
15 |
16 | 17 | 18 |
19 |
20 | 21 | 22 |
23 | 24 | 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /templates/terminal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Kubernetes Web Terminal 7 | 8 | 9 |
10 | 11 | 12 | 13 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /utility/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | # Author: huangchao -------------------------------------------------------------------------------- /utility/k8s.py: -------------------------------------------------------------------------------- 1 | # -*- coding=utf-8 -*- 2 | # Copyright 2018 Alex Ma 3 | 4 | """ 5 | :author Alex Ma 6 | :date 2018/10/15 7 | 8 | """ 9 | import os 10 | import threading 11 | from utility.log import log 12 | from kubernetes import client 13 | from kubernetes.stream import stream 14 | 15 | # from kubernetes.client import * 16 | # from kubernetes.client.rest import ApiException 17 | 18 | 19 | class KubernetesAPI(object): 20 | 21 | def __init__(self, api_host, ssl_ca_cert, key_file, cert_file): 22 | kub_conf = client.Configuration() 23 | kub_conf.host = api_host 24 | kub_conf.ssl_ca_cert = ssl_ca_cert 25 | kub_conf.cert_file = cert_file 26 | kub_conf.key_file = key_file 27 | 28 | self.api_client = client.ApiClient(configuration=kub_conf) 29 | self.client_core_v1 = client.CoreV1Api(api_client=self.api_client) 30 | self.client_apps_v1 = client.AppsV1Api(api_client=self.api_client) 31 | self.client_extensions_v1 = client.ExtensionsV1beta1Api( 32 | api_client=self.api_client) 33 | 34 | self.api_dict = {} 35 | 36 | def __getattr__(self, item): 37 | if item in self.api_dict: 38 | return self.api_dict[item] 39 | if hasattr(client, item) and callable(getattr(client, item)): 40 | self.api_dict[item] = getattr(client, item)( 41 | api_client=self.api_client) 42 | return self.api_dict[item] 43 | 44 | 45 | class K8SClient(KubernetesAPI): 46 | 47 | def __init__(self, api_host, ssl_ca_cert, key_file, cert_file): 48 | super(K8SClient, self).__init__( 49 | api_host, ssl_ca_cert, key_file, cert_file) 50 | 51 | @staticmethod 52 | def gen_ca(): 53 | ssl_ca_cert = os.path.join( 54 | os.path.dirname(os.path.dirname(__file__)), 55 | '_credentials/kubernetes_dev_ca_cert') 56 | key_file = os.path.join( 57 | os.path.dirname(os.path.dirname(__file__)), 58 | '_credentials/kubernetes_dev_key') 59 | cert_file = os.path.join( 60 | os.path.dirname(os.path.dirname(__file__)), 61 | '_credentials/kubernetes_dev_cert') 62 | 63 | return ssl_ca_cert, key_file, cert_file 64 | 65 | def terminal_start(self, namespace, pod_name, container): 66 | command = [ 67 | "/bin/sh", 68 | "-c", 69 | 'TERM=xterm-256color; export TERM; [ -x /bin/bash ] ' 70 | '&& ([ -x /usr/bin/script ] ' 71 | '&& /usr/bin/script -q -c "/bin/bash" /dev/null || exec /bin/bash) ' 72 | '|| exec /bin/sh'] 73 | 74 | container_stream = stream( 75 | self.client_core_v1.connect_get_namespaced_pod_exec, 76 | name=pod_name, 77 | namespace=namespace, 78 | container=container, 79 | command=command, 80 | stderr=True, stdin=True, 81 | stdout=True, tty=True, 82 | _preload_content=False 83 | ) 84 | 85 | return container_stream 86 | 87 | 88 | class K8SStreamThread(threading.Thread): 89 | 90 | def __init__(self, ws, container_stream): 91 | super(K8SStreamThread, self).__init__() 92 | self.ws = ws 93 | self.stream = container_stream 94 | 95 | def run(self): 96 | while not self.ws.closed: 97 | 98 | if not self.stream.is_open(): 99 | log.info('container stream closed') 100 | self.ws.close() 101 | 102 | try: 103 | if self.stream.peek_stdout(): 104 | stdout = self.stream.read_stdout() 105 | self.ws.send(stdout) 106 | 107 | if self.stream.peek_stderr(): 108 | stderr = self.stream.read_stderr() 109 | self.ws.send(stderr) 110 | except Exception as err: 111 | log.error('container stream err: {}'.format(err)) 112 | self.ws.close() 113 | break 114 | -------------------------------------------------------------------------------- /utility/log.py: -------------------------------------------------------------------------------- 1 | # -*- coding=utf-8 -*- 2 | # Copyright 2018 Alex Ma 3 | 4 | """ 5 | :author Alex Ma 6 | :date 2018/10/18 7 | 8 | """ 9 | import logging 10 | 11 | 12 | log = logging.getLogger('web_terminal') 13 | log.setLevel(logging.DEBUG) 14 | fh = logging.FileHandler('/tmp/web_terminal.log') 15 | fh.setFormatter(logging.Formatter( 16 | '%(asctime)s - %(name)s - %(levelname)s - %(message)s')) 17 | 18 | ch = logging.StreamHandler() 19 | ch.setLevel(logging.DEBUG) 20 | ch.setFormatter(logging.Formatter( 21 | '%(asctime)s - %(name)s - %(levelname)s - %(message)s')) 22 | log.addHandler(ch) 23 | --------------------------------------------------------------------------------