From a61ba2e140affbc1a247a93204bdc2ed6bafe71f Mon Sep 17 00:00:00 2001 From: pro-src Date: Thu, 26 Apr 2018 09:18:18 -0500 Subject: [PATCH 1/8] closes #1361 --- .npmignore | 55 ++++++++++++++++++++++++++++++++++++++++------------ package.json | 27 -------------------------- 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/.npmignore b/.npmignore index 63069bda..eeb46409 100644 --- a/.npmignore +++ b/.npmignore @@ -1,16 +1,47 @@ -node_modules/ -*.swp -.lock-wscript -lib/*.test.js -lib/*.test.js.map +# Blacklist - exclude everything except npm defaults such as LICENSE, etc +* +!*/ + +# Whitelist - entries to be included must be negated with "!" +!*.js +!*.json + +# Whitelist - dist/ +!dist/**/*.js +!dist/**/*.js.map + +!dist/**/*.css + +# Whitelist - lib/ +!lib/**/*.d.ts + +!lib/**/*.js +!lib/**/*.js.map + +!lib/**/*.css + +# Whitelist - src/ +!src/**/*.ts +!src/**/*.d.ts + +!src/**/*.js +!src/**/*.js.map + +!src/**/*.css + +# Whitelist - typings/ +!typings/*.d.ts + +# Blacklist - (normal behavior) these will override any whitelist +*.test.ts +*.test.d.ts +*.test.js +*.test.js.map lib/test/ -Makefile.gyp -*.Makefile -*.target.gyp.mk -*.node -example/*.log + docs/ -npm-debug.log /.idea/ -.env +.vscode/ build/ +fixtures/ +coverage/ diff --git a/package.json b/package.json index d4a06f82..4db430bc 100644 --- a/package.json +++ b/package.json @@ -11,33 +11,6 @@ "types": "typings/xterm.d.ts", "repository": "https://github.com/xtermjs/xterm.js", "license": "MIT", - "files": [ - "*.js", - "*.json", - "dist/*.css", - "dist/**/*.css", - "dist/*.js", - "dist/*.js.map", - "dist/**/*.js", - "dist/**/*.js.map", - "lib/*.css", - "lib/**/*.css", - "lib/*.d.ts", - "lib/*.js", - "lib/*.js.map", - "lib/**/*.d.ts", - "lib/**/*.js", - "lib/**/*.js.map", - "src/*.css", - "src/**/*.css", - "src/*.js", - "src/*.js.map", - "src/*.ts", - "src/**/*.js", - "src/**/*.js.map", - "src/**/*.ts", - "typings/*.d.ts" - ], "devDependencies": { "@types/chai": "^3.4.34", "@types/jsdom": "^11.0.1", From 30b88113a879d05a79a9c52b60408f580ca62f30 Mon Sep 17 00:00:00 2001 From: pro-src Date: Thu, 26 Apr 2018 12:09:21 -0500 Subject: [PATCH 2/8] explicitly exclude demo --- .npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmignore b/.npmignore index eeb46409..517ba0bd 100644 --- a/.npmignore +++ b/.npmignore @@ -45,3 +45,4 @@ docs/ build/ fixtures/ coverage/ +demo/ From cfdec9ff904ad412fc30f7695e878a94f938fddd Mon Sep 17 00:00:00 2001 From: Ledion Bitincka Date: Tue, 8 May 2018 16:27:54 -0700 Subject: [PATCH 3/8] add diag.ai --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 07baec5a..2b0944e6 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ computational environment for Jupyter, supporting interactive data science and s - [**FreeMAN**](https://github.com/matthew-matvei/freeman): A free, cross-platform file manager for power users - [**Fluent Terminal**](https://github.com/felixse/FluentTerminal): A terminal emulator based on UWP and web technologies. - [**Hyper**](https://hyper.is): A terminal built on web technologies +- [**Diag**](https://diag.ai): A better way to troubleshoot problems faster. Capture, share and reapply troubleshooting knowledge so you can focus on solving problems that matter. Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it in our list. From 3971fc9b4e21c1030908da172886dc2f8253edfd Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Wed, 9 May 2018 20:34:55 -0700 Subject: [PATCH 4/8] Save and restore the ctx for cached characters Drawing dim colors sets the globalAlpha to 0.5, so we need to save/restore the ctx state. Otherwise, every time we draw some dim content, our display will get progressively dimmer. I tested this by running `echo '\u001b[2mfoo'` a few times in zsh. Fixes #1424 --- src/renderer/BaseRenderLayer.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderer/BaseRenderLayer.ts b/src/renderer/BaseRenderLayer.ts index ca848b73..c2b65e16 100644 --- a/src/renderer/BaseRenderLayer.ts +++ b/src/renderer/BaseRenderLayer.ts @@ -250,6 +250,7 @@ export abstract class BaseRenderLayer implements IRenderLayer { const isDefaultBackground = bg >= 256; const drawInBrightColor = (terminal.options.drawBoldTextInBrightColors && bold && fg < 8); if (this._charAtlas && isAscii && (isBasicColor || isDefaultColor) && isDefaultBackground && !italic) { + this._ctx.save(); // we may set globalAlpha, so we need to be able to restore let colorIndex: number; if (isDefaultColor) { colorIndex = (bold && terminal.options.enableBold ? 1 : 0); @@ -275,6 +276,7 @@ export abstract class BaseRenderLayer implements IRenderLayer { y * this._scaledCellHeight + this._scaledCharTop, charAtlasCellWidth, this._scaledCharHeight); + this._ctx.restore(); } else { this._drawUncachedChar(terminal, char, width, fg + (drawInBrightColor ? 8 : 0), x, y, bold && terminal.options.enableBold, dim, italic); } From bce81f304ef284f42a2f9596d13adf3a1169955e Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 10 May 2018 16:11:25 +0800 Subject: [PATCH 5/8] Update how to use addons with Typescript --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 07baec5a..65f016c4 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,18 @@ The proposed way to load xterm.js is via the ES6 module syntax. import { Terminal } from 'xterm'; ``` -*Note: There are currently no typings for addons so you will need to upcast if using TypeScript, eg. `(xterm).fit()`.* +*Note: There are currently no typings for addons if they are accessed via extending Terminal prototype, so you will need to upcast if using TypeScript, eg. `(xterm).fit()`.* + +It is recommended to import addon function and enhance the terminal on demand. This would have better typing support and is friendly to treeshaking. E.g.: + +```typescript +import { Terminal } from 'xterm'; +import { fit } from 'xterm/lib/addons/fit/fit'; +const xterm = new Terminal(); + +// Fit the terminal when necessary: +fit(xterm); +``` ### Addons From ef4cda2cc635597f838078057b766225108c39cf Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Fri, 11 May 2018 11:20:02 +0800 Subject: [PATCH 6/8] revise importing addons in ts --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 65f016c4..dc14f853 100644 --- a/README.md +++ b/README.md @@ -57,19 +57,6 @@ The proposed way to load xterm.js is via the ES6 module syntax. import { Terminal } from 'xterm'; ``` -*Note: There are currently no typings for addons if they are accessed via extending Terminal prototype, so you will need to upcast if using TypeScript, eg. `(xterm).fit()`.* - -It is recommended to import addon function and enhance the terminal on demand. This would have better typing support and is friendly to treeshaking. E.g.: - -```typescript -import { Terminal } from 'xterm'; -import { fit } from 'xterm/lib/addons/fit/fit'; -const xterm = new Terminal(); - -// Fit the terminal when necessary: -fit(xterm); -``` - ### Addons Addons are JavaScript modules that extend the `Terminal` prototype with new methods and attributes to provide additional functionality. There are a handful available in the main repository in the `src/addons` directory and you can even write your own, by using xterm.js' public API. @@ -87,6 +74,21 @@ var xterm = new Terminal(); // Instantiate the terminal xterm.fit(); // Use the `fit` method, provided by the `fit` addon ``` +#### Importing Addons in TypeScript + +There are currently no typings for addons if they are accessed via extending Terminal prototype, so you will need to upcast if using TypeScript, eg. `(xterm).fit()`. + +Alternatively, you can import addon function and enhance the terminal on demand. This would have better typing support and is friendly to treeshaking. E.g.: + +```typescript +import { Terminal } from 'xterm'; +import { fit } from 'xterm/lib/addons/fit/fit'; +const xterm = new Terminal(); + +// Fit the terminal when necessary: +fit(xterm); +``` + #### Third party addons There are also the following third party addons available: From 9c1bee300d0983440c0f40447d90619ec781164e Mon Sep 17 00:00:00 2001 From: pro-src Date: Thu, 10 May 2018 23:03:12 -0500 Subject: [PATCH 7/8] Fix tsc --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d4a06f82..ee03147b 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@types/chai": "^3.4.34", "@types/jsdom": "^11.0.1", "@types/mocha": "^2.2.33", - "@types/node": "^6.0.41", + "@types/node": "6.0.108", "@types/text-encoding": "0.0.32", "browserify": "^13.3.0", "chai": "3.5.0", From 210a312fbff4a06f83f033ffdd3464cb4d1073c9 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 11 May 2018 07:49:37 -0700 Subject: [PATCH 8/8] Remove ignore key from package.json --- package.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/package.json b/package.json index ce58b98f..d060b08d 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,6 @@ "name": "xterm", "description": "Full xterm terminal, in your browser", "version": "3.3.0", - "ignore": [ - "demo", - "test", - ".gitignore" - ], "main": "lib/Terminal.js", "types": "typings/xterm.d.ts", "repository": "https://github.com/xtermjs/xterm.js", @@ -61,6 +56,5 @@ "coveralls": "gulp coveralls", "webpack": "gulp webpack", "watch": "gulp watch" - }, - "dependencies": {} + } }