@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/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/package.json +1 -1
- package/src/common/Color.ts +5 -2
- package/src/common/Platform.ts +1 -1
package/package.json
CHANGED
package/src/common/Color.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
package/src/common/Platform.ts
CHANGED
|
@@ -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
|
|