xterm.js库升级到5.0.0

This commit is contained in:
lwch
2022-09-19 11:14:33 +08:00
parent b8716f5149
commit cabda968b9
14 changed files with 36 additions and 18 deletions
+1 -1
View File
@@ -1 +1 @@
../xterm.js-4.14.1
../xterm.js-5.0.0
@@ -1,2 +0,0 @@
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AttachAddon=e():t.AttachAddon=e()}(self,(function(){return(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.AttachAddon=void 0;var s=function(){function t(t,e){this._disposables=[],this._socket=t,this._socket.binaryType="arraybuffer",this._bidirectional=!(e&&!1===e.bidirectional)}return t.prototype.activate=function(t){var e=this;this._disposables.push(o(this._socket,"message",(function(e){var s=e.data;t.write("string"==typeof s?s:new Uint8Array(s))}))),this._bidirectional&&(this._disposables.push(t.onData((function(t){return e._sendData(t)}))),this._disposables.push(t.onBinary((function(t){return e._sendBinary(t)})))),this._disposables.push(o(this._socket,"close",(function(){return e.dispose()}))),this._disposables.push(o(this._socket,"error",(function(){return e.dispose()})))},t.prototype.dispose=function(){for(var t=0,e=this._disposables;t<e.length;t++)e[t].dispose()},t.prototype._sendData=function(t){1===this._socket.readyState&&this._socket.send(t)},t.prototype._sendBinary=function(t){if(1===this._socket.readyState){for(var e=new Uint8Array(t.length),s=0;s<t.length;++s)e[s]=255&t.charCodeAt(s);this._socket.send(e)}},t}();function o(t,e,s){return t.addEventListener(e,s),{dispose:function(){s&&t.removeEventListener(e,s)}}}e.AttachAddon=s})(),t})()}));
//# sourceMappingURL=xterm-addon-attach.js.map
@@ -1 +0,0 @@
{"version":3,"file":"xterm-addon-attach.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAqB,YAAID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AAO8B,oBAAoBH,EAAMC,KAhE1B,EAAAG,YAAAA,G","sources":["webpack://AttachAddon/webpack/universalModuleDefinition","webpack://AttachAddon/./src/AttachAddon.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"AttachAddon\"] = factory();\n\telse\n\t\troot[\"AttachAddon\"] = factory();\n})(self, function() {\nreturn ","/**\n * Copyright (c) 2014, 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Implements the attach method, that attaches the terminal to a WebSocket stream.\n */\n\nimport { Terminal, IDisposable, ITerminalAddon } from 'xterm';\n\ninterface IAttachOptions {\n bidirectional?: boolean;\n}\n\nexport class AttachAddon implements ITerminalAddon {\n private _socket: WebSocket;\n private _bidirectional: boolean;\n private _disposables: IDisposable[] = [];\n\n constructor(socket: WebSocket, options?: IAttachOptions) {\n this._socket = socket;\n // always set binary type to arraybuffer, we do not handle blobs\n this._socket.binaryType = 'arraybuffer';\n this._bidirectional = !(options && options.bidirectional === false);\n }\n\n public activate(terminal: Terminal): void {\n this._disposables.push(\n addSocketListener(this._socket, 'message', ev => {\n const data: ArrayBuffer | string = ev.data;\n terminal.write(typeof data === 'string' ? data : new Uint8Array(data));\n })\n );\n\n if (this._bidirectional) {\n this._disposables.push(terminal.onData(data => this._sendData(data)));\n this._disposables.push(terminal.onBinary(data => this._sendBinary(data)));\n }\n\n this._disposables.push(addSocketListener(this._socket, 'close', () => this.dispose()));\n this._disposables.push(addSocketListener(this._socket, 'error', () => this.dispose()));\n }\n\n public dispose(): void {\n for (const d of this._disposables) {\n d.dispose();\n }\n }\n\n private _sendData(data: string): void {\n // TODO: do something better than just swallowing\n // the data if the socket is not in a working condition\n if (this._socket.readyState !== 1) {\n return;\n }\n this._socket.send(data);\n }\n\n private _sendBinary(data: string): void {\n if (this._socket.readyState !== 1) {\n return;\n }\n const buffer = new Uint8Array(data.length);\n for (let i = 0; i < data.length; ++i) {\n buffer[i] = data.charCodeAt(i) & 255;\n }\n this._socket.send(buffer);\n }\n}\n\nfunction addSocketListener<K extends keyof WebSocketEventMap>(socket: WebSocket, type: K, handler: (this: WebSocket, ev: WebSocketEventMap[K]) => any): IDisposable {\n socket.addEventListener(type, handler);\n return {\n dispose: () => {\n if (!handler) {\n // Already disposed\n return;\n }\n socket.removeEventListener(type, handler);\n }\n };\n}\n"],"names":["root","factory","exports","module","define","amd","self","socket","options","_disposables","this","_socket","binaryType","_bidirectional","bidirectional","activate","terminal","push","addSocketListener","ev","data","write","Uint8Array","onData","_sendData","onBinary","_sendBinary","dispose","readyState","send","buffer","length","i","charCodeAt","type","handler","addEventListener","removeEventListener","AttachAddon"],"sourceRoot":""}
@@ -1,2 +0,0 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(function(){return(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0;var r=function(){function e(){}return e.prototype.activate=function(e){this._terminal=e},e.prototype.dispose=function(){},e.prototype.fit=function(){var e=this.proposeDimensions();if(e&&this._terminal){var t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}},e.prototype.proposeDimensions=function(){if(this._terminal&&this._terminal.element&&this._terminal.element.parentElement){var e=this._terminal._core;if(0!==e._renderService.dimensions.actualCellWidth&&0!==e._renderService.dimensions.actualCellHeight){var t=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(t.getPropertyValue("height")),i=Math.max(0,parseInt(t.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o=r-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),a=i-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-e.viewport.scrollBarWidth;return{cols:Math.max(2,Math.floor(a/e._renderService.dimensions.actualCellWidth)),rows:Math.max(1,Math.floor(o/e._renderService.dimensions.actualCellHeight))}}}},e}();t.FitAddon=r})(),e})()}));
//# sourceMappingURL=xterm-addon-fit.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
!function(s,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AttachAddon=t():s.AttachAddon=t()}(self,(()=>(()=>{"use strict";var s={};return(()=>{var t=s;function e(s,t,e){return s.addEventListener(t,e),{dispose:()=>{e&&s.removeEventListener(t,e)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.AttachAddon=void 0,t.AttachAddon=class{constructor(s,t){this._disposables=[],this._socket=s,this._socket.binaryType="arraybuffer",this._bidirectional=!(t&&!1===t.bidirectional)}activate(s){this._disposables.push(e(this._socket,"message",(t=>{const e=t.data;s.write("string"==typeof e?e:new Uint8Array(e))}))),this._bidirectional&&(this._disposables.push(s.onData((s=>this._sendData(s)))),this._disposables.push(s.onBinary((s=>this._sendBinary(s))))),this._disposables.push(e(this._socket,"close",(()=>this.dispose()))),this._disposables.push(e(this._socket,"error",(()=>this.dispose())))}dispose(){for(const s of this._disposables)s.dispose()}_sendData(s){1===this._socket.readyState&&this._socket.send(s)}_sendBinary(s){if(1!==this._socket.readyState)return;const t=new Uint8Array(s.length);for(let e=0;e<s.length;++e)t[e]=255&s.charCodeAt(e);this._socket.send(t)}}})(),s})()));
//# sourceMappingURL=xterm-addon-attach.js.map
@@ -0,0 +1 @@
{"version":3,"file":"xterm-addon-attach.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD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QiB,KAAKC,EACpB,E","sources":["webpack://AttachAddon/webpack/universalModuleDefinition","webpack://AttachAddon/./src/AttachAddon.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"AttachAddon\"] = factory();\n\telse\n\t\troot[\"AttachAddon\"] = factory();\n})(self, () => {\nreturn ","/**\n * Copyright (c) 2014, 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Implements the attach method, that attaches the terminal to a WebSocket stream.\n */\n\nimport { Terminal, IDisposable, ITerminalAddon } from 'xterm';\n\ninterface IAttachOptions {\n bidirectional?: boolean;\n}\n\nexport class AttachAddon implements ITerminalAddon {\n private _socket: WebSocket;\n private _bidirectional: boolean;\n private _disposables: IDisposable[] = [];\n\n constructor(socket: WebSocket, options?: IAttachOptions) {\n this._socket = socket;\n // always set binary type to arraybuffer, we do not handle blobs\n this._socket.binaryType = 'arraybuffer';\n this._bidirectional = !(options && options.bidirectional === false);\n }\n\n public activate(terminal: Terminal): void {\n this._disposables.push(\n addSocketListener(this._socket, 'message', ev => {\n const data: ArrayBuffer | string = ev.data;\n terminal.write(typeof data === 'string' ? data : new Uint8Array(data));\n })\n );\n\n if (this._bidirectional) {\n this._disposables.push(terminal.onData(data => this._sendData(data)));\n this._disposables.push(terminal.onBinary(data => this._sendBinary(data)));\n }\n\n this._disposables.push(addSocketListener(this._socket, 'close', () => this.dispose()));\n this._disposables.push(addSocketListener(this._socket, 'error', () => this.dispose()));\n }\n\n public dispose(): void {\n for (const d of this._disposables) {\n d.dispose();\n }\n }\n\n private _sendData(data: string): void {\n // TODO: do something better than just swallowing\n // the data if the socket is not in a working condition\n if (this._socket.readyState !== 1) {\n return;\n }\n this._socket.send(data);\n }\n\n private _sendBinary(data: string): void {\n if (this._socket.readyState !== 1) {\n return;\n }\n const buffer = new Uint8Array(data.length);\n for (let i = 0; i < data.length; ++i) {\n buffer[i] = data.charCodeAt(i) & 255;\n }\n this._socket.send(buffer);\n }\n}\n\nfunction addSocketListener<K extends keyof WebSocketEventMap>(socket: WebSocket, type: K, handler: (this: WebSocket, ev: WebSocketEventMap[K]) => any): IDisposable {\n socket.addEventListener(type, handler);\n return {\n dispose: () => {\n if (!handler) {\n // Already disposed\n return;\n }\n socket.removeEventListener(type, handler);\n }\n };\n}\n"],"names":["root","factory","exports","module","define","amd","self","addSocketListener","socket","type","handler","addEventListener","dispose","removeEventListener","constructor","options","_disposables","this","_socket","binaryType","_bidirectional","bidirectional","activate","terminal","push","ev","data","write","Uint8Array","onData","_sendData","onBinary","_sendBinary","d","readyState","send","buffer","length","i","charCodeAt"],"sourceRoot":""}
@@ -0,0 +1,2 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{constructor(){}activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core;if(0===e._renderService.dimensions.actualCellWidth||0===e._renderService.dimensions.actualCellHeight)return;const t=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),a=n-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-t;return{cols:Math.max(2,Math.floor(a/e._renderService.dimensions.actualCellWidth)),rows:Math.max(1,Math.floor(s/e._renderService.dimensions.actualCellHeight))}}}})(),e})()));
//# sourceMappingURL=xterm-addon-fit.js.map
File diff suppressed because one or more lines are too long
@@ -36,6 +36,7 @@
*/
.xterm {
cursor: text;
position: relative;
user-select: none;
-ms-user-select: none;
@@ -124,16 +125,13 @@
line-height: normal;
}
.xterm {
cursor: text;
}
.xterm.enable-mouse-events {
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
cursor: default;
}
.xterm.xterm-cursor-pointer {
.xterm.xterm-cursor-pointer,
.xterm .xterm-cursor-pointer {
cursor: pointer;
}
@@ -165,10 +163,30 @@
opacity: 0.5;
}
.xterm-underline {
text-decoration: underline;
}
.xterm-underline-1 { text-decoration: underline; }
.xterm-underline-2 { text-decoration: double underline; }
.xterm-underline-3 { text-decoration: wavy underline; }
.xterm-underline-4 { text-decoration: dotted underline; }
.xterm-underline-5 { text-decoration: dashed underline; }
.xterm-strikethrough {
text-decoration: line-through;
}
.xterm-screen .xterm-decoration-container .xterm-decoration {
z-index: 6;
position: absolute;
}
.xterm-decoration-overview-ruler {
z-index: 7;
position: absolute;
top: 0;
right: 0;
pointer-events: none;
}
.xterm-decoration-top {
z-index: 2;
position: relative;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long