@xterm/xterm 5.5.0-beta.6 → 5.5.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xterm/xterm",
3
3
  "description": "Full xterm terminal, in your browser",
4
- "version": "5.5.0-beta.6",
4
+ "version": "5.5.0-beta.7",
5
5
  "main": "lib/xterm.js",
6
6
  "style": "css/xterm.css",
7
7
  "types": "typings/xterm.d.ts",
@@ -3,7 +3,6 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { isNode } from 'common/Platform';
7
6
  import { IColor, IColorRGB } from 'common/Types';
8
7
 
9
8
  let $r = 0;
@@ -117,9 +116,10 @@ export namespace color {
117
116
  * '#rrggbbaa').
118
117
  */
119
118
  export namespace css {
119
+ // Attempt to set get the shared canvas context
120
120
  let $ctx: CanvasRenderingContext2D | undefined;
121
121
  let $litmusColor: CanvasGradient | undefined;
122
- if (!isNode) {
122
+ try {
123
123
  // This is guaranteed to run in the first window, so document should be correct
124
124
  const canvas = document.createElement('canvas');
125
125
  canvas.width = 1;
@@ -133,6 +133,9 @@ export namespace css {
133
133
  $litmusColor = $ctx.createLinearGradient(0, 0, 1, 1);
134
134
  }
135
135
  }
136
+ catch {
137
+ // noop
138
+ }
136
139
 
137
140
  /**
138
141
  * Converts a css string to an IColor, this should handle all valid CSS color strings and will
@@ -14,7 +14,7 @@ interface INavigator {
14
14
  declare const navigator: INavigator;
15
15
  declare const process: unknown;
16
16
 
17
- export const isNode = (typeof process !== 'undefined') ? true : false;
17
+ export const isNode = (typeof process !== 'undefined' && 'title' in (process as any)) ? true : false;
18
18
  const userAgent = (isNode) ? 'node' : navigator.userAgent;
19
19
  const platform = (isNode) ? 'node' : navigator.platform;
20
20