@wendongfly/myhi 1.0.2 → 1.0.3
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/dist/index.js +1 -1
- package/dist/lib/xterm/LICENSE +21 -0
- package/dist/lib/xterm/README.md +225 -0
- package/dist/lib/xterm/css/xterm.css +190 -0
- package/dist/lib/xterm/lib/xterm.js +2 -0
- package/dist/lib/xterm/lib/xterm.js.map +1 -0
- package/dist/lib/xterm/package.json +90 -0
- package/dist/lib/xterm/src/browser/AccessibilityManager.ts +301 -0
- package/dist/lib/xterm/src/browser/Clipboard.ts +99 -0
- package/dist/lib/xterm/src/browser/ColorContrastCache.ts +39 -0
- package/dist/lib/xterm/src/browser/ColorManager.ts +268 -0
- package/dist/lib/xterm/src/browser/Dom.ts +10 -0
- package/dist/lib/xterm/src/browser/Lifecycle.ts +30 -0
- package/dist/lib/xterm/src/browser/Linkifier.ts +356 -0
- package/dist/lib/xterm/src/browser/Linkifier2.ts +397 -0
- package/dist/lib/xterm/src/browser/LocalizableStrings.ts +10 -0
- package/dist/lib/xterm/src/browser/MouseZoneManager.ts +236 -0
- package/dist/lib/xterm/src/browser/RenderDebouncer.ts +82 -0
- package/dist/lib/xterm/src/browser/ScreenDprMonitor.ts +69 -0
- package/dist/lib/xterm/src/browser/Terminal.ts +1447 -0
- package/dist/lib/xterm/src/browser/TimeBasedDebouncer.ts +86 -0
- package/dist/lib/xterm/src/browser/Types.d.ts +317 -0
- package/dist/lib/xterm/src/browser/Viewport.ts +276 -0
- package/dist/lib/xterm/src/browser/decorations/BufferDecorationRenderer.ts +131 -0
- package/dist/lib/xterm/src/browser/decorations/ColorZoneStore.ts +117 -0
- package/dist/lib/xterm/src/browser/decorations/OverviewRulerRenderer.ts +228 -0
- package/dist/lib/xterm/src/browser/input/CompositionHelper.ts +237 -0
- package/dist/lib/xterm/src/browser/input/Mouse.ts +64 -0
- package/dist/lib/xterm/src/browser/input/MoveToCell.ts +249 -0
- package/dist/lib/xterm/src/browser/public/Terminal.ts +298 -0
- package/dist/lib/xterm/src/browser/renderer/BaseRenderLayer.ts +582 -0
- package/dist/lib/xterm/src/browser/renderer/CursorRenderLayer.ts +378 -0
- package/dist/lib/xterm/src/browser/renderer/CustomGlyphs.ts +632 -0
- package/dist/lib/xterm/src/browser/renderer/GridCache.ts +33 -0
- package/dist/lib/xterm/src/browser/renderer/LinkRenderLayer.ts +84 -0
- package/dist/lib/xterm/src/browser/renderer/Renderer.ts +219 -0
- package/dist/lib/xterm/src/browser/renderer/RendererUtils.ts +26 -0
- package/dist/lib/xterm/src/browser/renderer/SelectionRenderLayer.ts +131 -0
- package/dist/lib/xterm/src/browser/renderer/TextRenderLayer.ts +344 -0
- package/dist/lib/xterm/src/browser/renderer/Types.d.ts +109 -0
- package/dist/lib/xterm/src/browser/renderer/atlas/BaseCharAtlas.ts +58 -0
- package/dist/lib/xterm/src/browser/renderer/atlas/CharAtlasCache.ts +95 -0
- package/dist/lib/xterm/src/browser/renderer/atlas/CharAtlasUtils.ts +54 -0
- package/dist/lib/xterm/src/browser/renderer/atlas/Constants.ts +15 -0
- package/dist/lib/xterm/src/browser/renderer/atlas/DynamicCharAtlas.ts +404 -0
- package/dist/lib/xterm/src/browser/renderer/atlas/LRUMap.ts +136 -0
- package/dist/lib/xterm/src/browser/renderer/atlas/Types.d.ts +29 -0
- package/dist/lib/xterm/src/browser/renderer/dom/DomRenderer.ts +403 -0
- package/dist/lib/xterm/src/browser/renderer/dom/DomRendererRowFactory.ts +344 -0
- package/dist/lib/xterm/src/browser/selection/SelectionModel.ts +144 -0
- package/dist/lib/xterm/src/browser/selection/Types.d.ts +15 -0
- package/dist/lib/xterm/src/browser/services/CharSizeService.ts +87 -0
- package/dist/lib/xterm/src/browser/services/CharacterJoinerService.ts +339 -0
- package/dist/lib/xterm/src/browser/services/CoreBrowserService.ts +20 -0
- package/dist/lib/xterm/src/browser/services/MouseService.ts +36 -0
- package/dist/lib/xterm/src/browser/services/RenderService.ts +237 -0
- package/dist/lib/xterm/src/browser/services/SelectionService.ts +1027 -0
- package/dist/lib/xterm/src/browser/services/Services.ts +123 -0
- package/dist/lib/xterm/src/browser/services/SoundService.ts +63 -0
- package/dist/lib/xterm/src/common/CircularList.ts +239 -0
- package/dist/lib/xterm/src/common/Clone.ts +23 -0
- package/dist/lib/xterm/src/common/Color.ts +285 -0
- package/dist/lib/xterm/src/common/CoreTerminal.ts +300 -0
- package/dist/lib/xterm/src/common/EventEmitter.ts +69 -0
- package/dist/lib/xterm/src/common/InputHandler.ts +3230 -0
- package/dist/lib/xterm/src/common/Lifecycle.ts +68 -0
- package/dist/lib/xterm/src/common/Platform.ts +31 -0
- package/dist/lib/xterm/src/common/SortedList.ts +88 -0
- package/dist/lib/xterm/src/common/TypedArrayUtils.ts +50 -0
- package/dist/lib/xterm/src/common/Types.d.ts +489 -0
- package/dist/lib/xterm/src/common/WindowsMode.ts +27 -0
- package/dist/lib/xterm/src/common/buffer/AttributeData.ts +148 -0
- package/dist/lib/xterm/src/common/buffer/Buffer.ts +711 -0
- package/dist/lib/xterm/src/common/buffer/BufferLine.ts +441 -0
- package/dist/lib/xterm/src/common/buffer/BufferRange.ts +13 -0
- package/dist/lib/xterm/src/common/buffer/BufferReflow.ts +220 -0
- package/dist/lib/xterm/src/common/buffer/BufferSet.ts +131 -0
- package/dist/lib/xterm/src/common/buffer/CellData.ts +94 -0
- package/dist/lib/xterm/src/common/buffer/Constants.ts +139 -0
- package/dist/lib/xterm/src/common/buffer/Marker.ts +37 -0
- package/dist/lib/xterm/src/common/buffer/Types.d.ts +64 -0
- package/dist/lib/xterm/src/common/data/Charsets.ts +256 -0
- package/dist/lib/xterm/src/common/data/EscapeSequences.ts +153 -0
- package/dist/lib/xterm/src/common/input/Keyboard.ts +398 -0
- package/dist/lib/xterm/src/common/input/TextDecoder.ts +346 -0
- package/dist/lib/xterm/src/common/input/UnicodeV6.ts +133 -0
- package/dist/lib/xterm/src/common/input/WriteBuffer.ts +229 -0
- package/dist/lib/xterm/src/common/input/XParseColor.ts +80 -0
- package/dist/lib/xterm/src/common/parser/Constants.ts +58 -0
- package/dist/lib/xterm/src/common/parser/DcsParser.ts +192 -0
- package/dist/lib/xterm/src/common/parser/EscapeSequenceParser.ts +796 -0
- package/dist/lib/xterm/src/common/parser/OscParser.ts +238 -0
- package/dist/lib/xterm/src/common/parser/Params.ts +229 -0
- package/dist/lib/xterm/src/common/parser/Types.d.ts +274 -0
- package/dist/lib/xterm/src/common/public/AddonManager.ts +56 -0
- package/dist/lib/xterm/src/common/public/BufferApiView.ts +35 -0
- package/dist/lib/xterm/src/common/public/BufferLineApiView.ts +29 -0
- package/dist/lib/xterm/src/common/public/BufferNamespaceApi.ts +33 -0
- package/dist/lib/xterm/src/common/public/ParserApi.ts +37 -0
- package/dist/lib/xterm/src/common/public/UnicodeApi.ts +27 -0
- package/dist/lib/xterm/src/common/services/BufferService.ts +185 -0
- package/dist/lib/xterm/src/common/services/CharsetService.ts +34 -0
- package/dist/lib/xterm/src/common/services/CoreMouseService.ts +309 -0
- package/dist/lib/xterm/src/common/services/CoreService.ts +92 -0
- package/dist/lib/xterm/src/common/services/DecorationService.ts +139 -0
- package/dist/lib/xterm/src/common/services/DirtyRowService.ts +53 -0
- package/dist/lib/xterm/src/common/services/InstantiationService.ts +83 -0
- package/dist/lib/xterm/src/common/services/LogService.ts +88 -0
- package/dist/lib/xterm/src/common/services/OptionsService.ts +178 -0
- package/dist/lib/xterm/src/common/services/ServiceRegistry.ts +49 -0
- package/dist/lib/xterm/src/common/services/Services.ts +323 -0
- package/dist/lib/xterm/src/common/services/UnicodeService.ts +82 -0
- package/dist/lib/xterm/src/headless/Terminal.ts +170 -0
- package/dist/lib/xterm/src/headless/Types.d.ts +31 -0
- package/dist/lib/xterm/src/headless/public/Terminal.ts +216 -0
- package/dist/lib/xterm/typings/xterm.d.ts +1872 -0
- package/dist/lib/xterm-fit/LICENSE +19 -0
- package/dist/lib/xterm-fit/README.md +24 -0
- package/dist/lib/xterm-fit/lib/xterm-addon-fit.js +2 -0
- package/dist/lib/xterm-fit/lib/xterm-addon-fit.js.map +1 -0
- package/dist/lib/xterm-fit/out/FitAddon.js +58 -0
- package/dist/lib/xterm-fit/out/FitAddon.js.map +1 -0
- package/dist/lib/xterm-fit/out-test/FitAddon.api.js.map +1 -0
- package/dist/lib/xterm-fit/package.json +21 -0
- package/dist/lib/xterm-fit/src/FitAddon.ts +86 -0
- package/dist/lib/xterm-fit/typings/xterm-addon-fit.d.ts +55 -0
- package/dist/lib/xterm-links/LICENSE +19 -0
- package/dist/lib/xterm-links/README.md +21 -0
- package/dist/lib/xterm-links/lib/xterm-addon-web-links.js +2 -0
- package/dist/lib/xterm-links/lib/xterm-addon-web-links.js.map +1 -0
- package/dist/lib/xterm-links/package.json +26 -0
- package/dist/lib/xterm-links/src/WebLinkProvider.ts +145 -0
- package/dist/lib/xterm-links/src/WebLinksAddon.ts +77 -0
- package/dist/lib/xterm-links/typings/xterm-addon-web-links.d.ts +58 -0
- package/package.json +1 -1
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IColorManager, IColorSet, IColorContrastCache } from 'browser/Types';
|
|
7
|
+
import { ITheme } from 'common/services/Services';
|
|
8
|
+
import { channels, color, css } from 'common/Color';
|
|
9
|
+
import { ColorContrastCache } from 'browser/ColorContrastCache';
|
|
10
|
+
import { ColorIndex, IColor } from 'common/Types';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
interface IRestoreColorSet {
|
|
14
|
+
foreground: IColor;
|
|
15
|
+
background: IColor;
|
|
16
|
+
cursor: IColor;
|
|
17
|
+
ansi: IColor[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const DEFAULT_FOREGROUND = css.toColor('#ffffff');
|
|
22
|
+
const DEFAULT_BACKGROUND = css.toColor('#000000');
|
|
23
|
+
const DEFAULT_CURSOR = css.toColor('#ffffff');
|
|
24
|
+
const DEFAULT_CURSOR_ACCENT = css.toColor('#000000');
|
|
25
|
+
const DEFAULT_SELECTION = {
|
|
26
|
+
css: 'rgba(255, 255, 255, 0.3)',
|
|
27
|
+
rgba: 0xFFFFFF4D
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// An IIFE to generate DEFAULT_ANSI_COLORS.
|
|
31
|
+
export const DEFAULT_ANSI_COLORS = Object.freeze((() => {
|
|
32
|
+
const colors = [
|
|
33
|
+
// dark:
|
|
34
|
+
css.toColor('#2e3436'),
|
|
35
|
+
css.toColor('#cc0000'),
|
|
36
|
+
css.toColor('#4e9a06'),
|
|
37
|
+
css.toColor('#c4a000'),
|
|
38
|
+
css.toColor('#3465a4'),
|
|
39
|
+
css.toColor('#75507b'),
|
|
40
|
+
css.toColor('#06989a'),
|
|
41
|
+
css.toColor('#d3d7cf'),
|
|
42
|
+
// bright:
|
|
43
|
+
css.toColor('#555753'),
|
|
44
|
+
css.toColor('#ef2929'),
|
|
45
|
+
css.toColor('#8ae234'),
|
|
46
|
+
css.toColor('#fce94f'),
|
|
47
|
+
css.toColor('#729fcf'),
|
|
48
|
+
css.toColor('#ad7fa8'),
|
|
49
|
+
css.toColor('#34e2e2'),
|
|
50
|
+
css.toColor('#eeeeec')
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
// Fill in the remaining 240 ANSI colors.
|
|
54
|
+
// Generate colors (16-231)
|
|
55
|
+
const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];
|
|
56
|
+
for (let i = 0; i < 216; i++) {
|
|
57
|
+
const r = v[(i / 36) % 6 | 0];
|
|
58
|
+
const g = v[(i / 6) % 6 | 0];
|
|
59
|
+
const b = v[i % 6];
|
|
60
|
+
colors.push({
|
|
61
|
+
css: channels.toCss(r, g, b),
|
|
62
|
+
rgba: channels.toRgba(r, g, b)
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Generate greys (232-255)
|
|
67
|
+
for (let i = 0; i < 24; i++) {
|
|
68
|
+
const c = 8 + i * 10;
|
|
69
|
+
colors.push({
|
|
70
|
+
css: channels.toCss(c, c, c),
|
|
71
|
+
rgba: channels.toRgba(c, c, c)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return colors;
|
|
76
|
+
})());
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Manages the source of truth for a terminal's colors.
|
|
80
|
+
*/
|
|
81
|
+
export class ColorManager implements IColorManager {
|
|
82
|
+
public colors: IColorSet;
|
|
83
|
+
private _ctx: CanvasRenderingContext2D;
|
|
84
|
+
private _litmusColor: CanvasGradient;
|
|
85
|
+
private _contrastCache: IColorContrastCache;
|
|
86
|
+
private _restoreColors!: IRestoreColorSet;
|
|
87
|
+
|
|
88
|
+
constructor(document: Document, public allowTransparency: boolean) {
|
|
89
|
+
const canvas = document.createElement('canvas');
|
|
90
|
+
canvas.width = 1;
|
|
91
|
+
canvas.height = 1;
|
|
92
|
+
const ctx = canvas.getContext('2d');
|
|
93
|
+
if (!ctx) {
|
|
94
|
+
throw new Error('Could not get rendering context');
|
|
95
|
+
}
|
|
96
|
+
this._ctx = ctx;
|
|
97
|
+
this._ctx.globalCompositeOperation = 'copy';
|
|
98
|
+
this._litmusColor = this._ctx.createLinearGradient(0, 0, 1, 1);
|
|
99
|
+
this._contrastCache = new ColorContrastCache();
|
|
100
|
+
this.colors = {
|
|
101
|
+
foreground: DEFAULT_FOREGROUND,
|
|
102
|
+
background: DEFAULT_BACKGROUND,
|
|
103
|
+
cursor: DEFAULT_CURSOR,
|
|
104
|
+
cursorAccent: DEFAULT_CURSOR_ACCENT,
|
|
105
|
+
selectionTransparent: DEFAULT_SELECTION,
|
|
106
|
+
selectionOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
|
|
107
|
+
selectionForeground: undefined,
|
|
108
|
+
ansi: DEFAULT_ANSI_COLORS.slice(),
|
|
109
|
+
contrastCache: this._contrastCache
|
|
110
|
+
};
|
|
111
|
+
this._updateRestoreColors();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public onOptionsChange(key: string): void {
|
|
115
|
+
if (key === 'minimumContrastRatio') {
|
|
116
|
+
this._contrastCache.clear();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Sets the terminal's theme.
|
|
122
|
+
* @param theme The theme to use. If a partial theme is provided then default
|
|
123
|
+
* colors will be used where colors are not defined.
|
|
124
|
+
*/
|
|
125
|
+
public setTheme(theme: ITheme = {}): void {
|
|
126
|
+
this.colors.foreground = this._parseColor(theme.foreground, DEFAULT_FOREGROUND);
|
|
127
|
+
this.colors.background = this._parseColor(theme.background, DEFAULT_BACKGROUND);
|
|
128
|
+
this.colors.cursor = this._parseColor(theme.cursor, DEFAULT_CURSOR, true);
|
|
129
|
+
this.colors.cursorAccent = this._parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT, true);
|
|
130
|
+
this.colors.selectionTransparent = this._parseColor(theme.selection, DEFAULT_SELECTION, true);
|
|
131
|
+
this.colors.selectionOpaque = color.blend(this.colors.background, this.colors.selectionTransparent);
|
|
132
|
+
const nullColor: IColor = {
|
|
133
|
+
css: '',
|
|
134
|
+
rgba: 0
|
|
135
|
+
};
|
|
136
|
+
this.colors.selectionForeground = theme.selectionForeground ? this._parseColor(theme.selectionForeground, nullColor) : undefined;
|
|
137
|
+
if (this.colors.selectionForeground === nullColor) {
|
|
138
|
+
this.colors.selectionForeground = undefined;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* If selection color is opaque, blend it with background with 0.3 opacity
|
|
143
|
+
* Issue #2737
|
|
144
|
+
*/
|
|
145
|
+
if (color.isOpaque(this.colors.selectionTransparent)) {
|
|
146
|
+
const opacity = 0.3;
|
|
147
|
+
this.colors.selectionTransparent = color.opacity(this.colors.selectionTransparent, opacity);
|
|
148
|
+
}
|
|
149
|
+
this.colors.ansi[0] = this._parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);
|
|
150
|
+
this.colors.ansi[1] = this._parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);
|
|
151
|
+
this.colors.ansi[2] = this._parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);
|
|
152
|
+
this.colors.ansi[3] = this._parseColor(theme.yellow, DEFAULT_ANSI_COLORS[3]);
|
|
153
|
+
this.colors.ansi[4] = this._parseColor(theme.blue, DEFAULT_ANSI_COLORS[4]);
|
|
154
|
+
this.colors.ansi[5] = this._parseColor(theme.magenta, DEFAULT_ANSI_COLORS[5]);
|
|
155
|
+
this.colors.ansi[6] = this._parseColor(theme.cyan, DEFAULT_ANSI_COLORS[6]);
|
|
156
|
+
this.colors.ansi[7] = this._parseColor(theme.white, DEFAULT_ANSI_COLORS[7]);
|
|
157
|
+
this.colors.ansi[8] = this._parseColor(theme.brightBlack, DEFAULT_ANSI_COLORS[8]);
|
|
158
|
+
this.colors.ansi[9] = this._parseColor(theme.brightRed, DEFAULT_ANSI_COLORS[9]);
|
|
159
|
+
this.colors.ansi[10] = this._parseColor(theme.brightGreen, DEFAULT_ANSI_COLORS[10]);
|
|
160
|
+
this.colors.ansi[11] = this._parseColor(theme.brightYellow, DEFAULT_ANSI_COLORS[11]);
|
|
161
|
+
this.colors.ansi[12] = this._parseColor(theme.brightBlue, DEFAULT_ANSI_COLORS[12]);
|
|
162
|
+
this.colors.ansi[13] = this._parseColor(theme.brightMagenta, DEFAULT_ANSI_COLORS[13]);
|
|
163
|
+
this.colors.ansi[14] = this._parseColor(theme.brightCyan, DEFAULT_ANSI_COLORS[14]);
|
|
164
|
+
this.colors.ansi[15] = this._parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);
|
|
165
|
+
// Clear our the cache
|
|
166
|
+
this._contrastCache.clear();
|
|
167
|
+
this._updateRestoreColors();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public restoreColor(slot?: ColorIndex): void {
|
|
171
|
+
// unset slot restores all ansi colors
|
|
172
|
+
if (slot === undefined) {
|
|
173
|
+
for (let i = 0; i < this._restoreColors.ansi.length; ++i) {
|
|
174
|
+
this.colors.ansi[i] = this._restoreColors.ansi[i];
|
|
175
|
+
}
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
switch (slot) {
|
|
179
|
+
case ColorIndex.FOREGROUND:
|
|
180
|
+
this.colors.foreground = this._restoreColors.foreground;
|
|
181
|
+
break;
|
|
182
|
+
case ColorIndex.BACKGROUND:
|
|
183
|
+
this.colors.background = this._restoreColors.background;
|
|
184
|
+
break;
|
|
185
|
+
case ColorIndex.CURSOR:
|
|
186
|
+
this.colors.cursor = this._restoreColors.cursor;
|
|
187
|
+
break;
|
|
188
|
+
default:
|
|
189
|
+
this.colors.ansi[slot] = this._restoreColors.ansi[slot];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private _updateRestoreColors(): void {
|
|
194
|
+
this._restoreColors = {
|
|
195
|
+
foreground: this.colors.foreground,
|
|
196
|
+
background: this.colors.background,
|
|
197
|
+
cursor: this.colors.cursor,
|
|
198
|
+
ansi: this.colors.ansi.slice()
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private _parseColor(
|
|
203
|
+
css: string | undefined,
|
|
204
|
+
fallback: IColor,
|
|
205
|
+
allowTransparency: boolean = this.allowTransparency
|
|
206
|
+
): IColor {
|
|
207
|
+
if (css === undefined) {
|
|
208
|
+
return fallback;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// If parsing the value results in failure, then it must be ignored, and the attribute must
|
|
212
|
+
// retain its previous value.
|
|
213
|
+
// -- https://html.spec.whatwg.org/multipage/canvas.html#fill-and-stroke-styles
|
|
214
|
+
this._ctx.fillStyle = this._litmusColor;
|
|
215
|
+
this._ctx.fillStyle = css;
|
|
216
|
+
if (typeof this._ctx.fillStyle !== 'string') {
|
|
217
|
+
console.warn(`Color: ${css} is invalid using fallback ${fallback.css}`);
|
|
218
|
+
return fallback;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
this._ctx.fillRect(0, 0, 1, 1);
|
|
222
|
+
const data = this._ctx.getImageData(0, 0, 1, 1).data;
|
|
223
|
+
|
|
224
|
+
// Check if the printed color was transparent
|
|
225
|
+
if (data[3] !== 0xFF) {
|
|
226
|
+
if (!allowTransparency) {
|
|
227
|
+
// Ideally we'd just ignore the alpha channel, but...
|
|
228
|
+
//
|
|
229
|
+
// Browsers may not give back exactly the same RGB values we put in, because most/all
|
|
230
|
+
// convert the color to a pre-multiplied representation. getImageData converts that back to
|
|
231
|
+
// a un-premultipled representation, but the precision loss may make the RGB channels unuable
|
|
232
|
+
// on their own.
|
|
233
|
+
//
|
|
234
|
+
// E.g. In Chrome #12345610 turns into #10305010, and in the extreme case, 0xFFFFFF00 turns
|
|
235
|
+
// into 0x00000000.
|
|
236
|
+
//
|
|
237
|
+
// "Note: Due to the lossy nature of converting to and from premultiplied alpha color values,
|
|
238
|
+
// pixels that have just been set using putImageData() might be returned to an equivalent
|
|
239
|
+
// getImageData() as different values."
|
|
240
|
+
// -- https://html.spec.whatwg.org/multipage/canvas.html#pixel-manipulation
|
|
241
|
+
//
|
|
242
|
+
// So let's just use the fallback color in this case instead.
|
|
243
|
+
console.warn(
|
|
244
|
+
`Color: ${css} is using transparency, but allowTransparency is false. ` +
|
|
245
|
+
`Using fallback ${fallback.css}.`
|
|
246
|
+
);
|
|
247
|
+
return fallback;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color
|
|
251
|
+
// the color value has alpha less than 1.0, and the string is the color value in the CSS rgba()
|
|
252
|
+
const [r, g, b, a] = this._ctx.fillStyle.substring(5, this._ctx.fillStyle.length - 1).split(',').map(component => Number(component));
|
|
253
|
+
const alpha = Math.round(a * 255);
|
|
254
|
+
const rgba: number = channels.toRgba(r, g, b, alpha);
|
|
255
|
+
return {
|
|
256
|
+
rgba,
|
|
257
|
+
css
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return {
|
|
262
|
+
// https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color
|
|
263
|
+
// if it has alpha equal to 1.0, then the string is a lowercase six-digit hex value, prefixed with a "#" character
|
|
264
|
+
css: this._ctx.fillStyle,
|
|
265
|
+
rgba: channels.toRgba(data[0], data[1], data[2], data[3])
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IDisposable } from 'common/Types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Adds a disposable listener to a node in the DOM, returning the disposable.
|
|
10
|
+
* @param type The event type.
|
|
11
|
+
* @param handler The handler for the listener.
|
|
12
|
+
*/
|
|
13
|
+
export function addDisposableDomListener(
|
|
14
|
+
node: Element | Window | Document,
|
|
15
|
+
type: string,
|
|
16
|
+
handler: (e: any) => void,
|
|
17
|
+
options?: boolean | AddEventListenerOptions
|
|
18
|
+
): IDisposable {
|
|
19
|
+
node.addEventListener(type, handler, options);
|
|
20
|
+
let disposed = false;
|
|
21
|
+
return {
|
|
22
|
+
dispose: () => {
|
|
23
|
+
if (disposed) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
disposed = true;
|
|
27
|
+
node.removeEventListener(type, handler, options);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ILinkifierEvent, ILinkMatcher, LinkMatcherHandler, ILinkMatcherOptions, ILinkifier, IMouseZoneManager, IMouseZone, IRegisteredLinkMatcher } from 'browser/Types';
|
|
7
|
+
import { IBufferStringIteratorResult } from 'common/buffer/Types';
|
|
8
|
+
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
|
9
|
+
import { ILogService, IBufferService, IOptionsService, IUnicodeService } from 'common/services/Services';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Limit of the unwrapping line expansion (overscan) at the top and bottom
|
|
13
|
+
* of the actual viewport in ASCII characters.
|
|
14
|
+
* A limit of 2000 should match most sane urls.
|
|
15
|
+
*/
|
|
16
|
+
const OVERSCAN_CHAR_LIMIT = 2000;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The Linkifier applies links to rows shortly after they have been refreshed.
|
|
20
|
+
*/
|
|
21
|
+
export class Linkifier implements ILinkifier {
|
|
22
|
+
/**
|
|
23
|
+
* The time to wait after a row is changed before it is linkified. This prevents
|
|
24
|
+
* the costly operation of searching every row multiple times, potentially a
|
|
25
|
+
* huge amount of times.
|
|
26
|
+
*/
|
|
27
|
+
protected static _timeBeforeLatency = 200;
|
|
28
|
+
|
|
29
|
+
protected _linkMatchers: IRegisteredLinkMatcher[] = [];
|
|
30
|
+
|
|
31
|
+
private _mouseZoneManager: IMouseZoneManager | undefined;
|
|
32
|
+
private _element: HTMLElement | undefined;
|
|
33
|
+
|
|
34
|
+
private _rowsTimeoutId: number | undefined;
|
|
35
|
+
private _nextLinkMatcherId = 0;
|
|
36
|
+
private _rowsToLinkify: { start: number | undefined, end: number | undefined };
|
|
37
|
+
|
|
38
|
+
private _onShowLinkUnderline = new EventEmitter<ILinkifierEvent>();
|
|
39
|
+
public get onShowLinkUnderline(): IEvent<ILinkifierEvent> { return this._onShowLinkUnderline.event; }
|
|
40
|
+
private _onHideLinkUnderline = new EventEmitter<ILinkifierEvent>();
|
|
41
|
+
public get onHideLinkUnderline(): IEvent<ILinkifierEvent> { return this._onHideLinkUnderline.event; }
|
|
42
|
+
private _onLinkTooltip = new EventEmitter<ILinkifierEvent>();
|
|
43
|
+
public get onLinkTooltip(): IEvent<ILinkifierEvent> { return this._onLinkTooltip.event; }
|
|
44
|
+
|
|
45
|
+
constructor(
|
|
46
|
+
@IBufferService protected readonly _bufferService: IBufferService,
|
|
47
|
+
@ILogService private readonly _logService: ILogService,
|
|
48
|
+
@IUnicodeService private readonly _unicodeService: IUnicodeService
|
|
49
|
+
) {
|
|
50
|
+
this._rowsToLinkify = {
|
|
51
|
+
start: undefined,
|
|
52
|
+
end: undefined
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Attaches the linkifier to the DOM, enabling linkification.
|
|
58
|
+
* @param mouseZoneManager The mouse zone manager to register link zones with.
|
|
59
|
+
*/
|
|
60
|
+
public attachToDom(element: HTMLElement, mouseZoneManager: IMouseZoneManager): void {
|
|
61
|
+
this._element = element;
|
|
62
|
+
this._mouseZoneManager = mouseZoneManager;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Queue linkification on a set of rows.
|
|
67
|
+
* @param start The row to linkify from (inclusive).
|
|
68
|
+
* @param end The row to linkify to (inclusive).
|
|
69
|
+
*/
|
|
70
|
+
public linkifyRows(start: number, end: number): void {
|
|
71
|
+
// Don't attempt linkify if not yet attached to DOM
|
|
72
|
+
if (!this._mouseZoneManager) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Increase range to linkify
|
|
77
|
+
if (this._rowsToLinkify.start === undefined || this._rowsToLinkify.end === undefined) {
|
|
78
|
+
this._rowsToLinkify.start = start;
|
|
79
|
+
this._rowsToLinkify.end = end;
|
|
80
|
+
} else {
|
|
81
|
+
this._rowsToLinkify.start = Math.min(this._rowsToLinkify.start, start);
|
|
82
|
+
this._rowsToLinkify.end = Math.max(this._rowsToLinkify.end, end);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Clear out any existing links on this row range
|
|
86
|
+
this._mouseZoneManager.clearAll(start, end);
|
|
87
|
+
|
|
88
|
+
// Restart timer
|
|
89
|
+
if (this._rowsTimeoutId) {
|
|
90
|
+
clearTimeout(this._rowsTimeoutId);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Cannot use window.setTimeout since tests need to run in node
|
|
94
|
+
this._rowsTimeoutId = setTimeout(() => this._linkifyRows(), Linkifier._timeBeforeLatency) as any as number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Linkifies the rows requested.
|
|
99
|
+
*/
|
|
100
|
+
private _linkifyRows(): void {
|
|
101
|
+
this._rowsTimeoutId = undefined;
|
|
102
|
+
const buffer = this._bufferService.buffer;
|
|
103
|
+
|
|
104
|
+
if (this._rowsToLinkify.start === undefined || this._rowsToLinkify.end === undefined) {
|
|
105
|
+
this._logService.debug('_rowToLinkify was unset before _linkifyRows was called');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Ensure the start row exists
|
|
110
|
+
const absoluteRowIndexStart = buffer.ydisp + this._rowsToLinkify.start;
|
|
111
|
+
if (absoluteRowIndexStart >= buffer.lines.length) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Invalidate bad end row values (if a resize happened)
|
|
116
|
+
const absoluteRowIndexEnd = buffer.ydisp + Math.min(this._rowsToLinkify.end, this._bufferService.rows) + 1;
|
|
117
|
+
|
|
118
|
+
// Iterate over the range of unwrapped content strings within start..end
|
|
119
|
+
// (excluding).
|
|
120
|
+
// _doLinkifyRow gets full unwrapped lines with the start row as buffer offset
|
|
121
|
+
// for every matcher.
|
|
122
|
+
// The unwrapping is needed to also match content that got wrapped across
|
|
123
|
+
// several buffer lines. To avoid a worst case scenario where the whole buffer
|
|
124
|
+
// contains just a single unwrapped string we limit this line expansion beyond
|
|
125
|
+
// the viewport to +OVERSCAN_CHAR_LIMIT chars (overscan) at top and bottom.
|
|
126
|
+
// This comes with the tradeoff that matches longer than OVERSCAN_CHAR_LIMIT
|
|
127
|
+
// chars will not match anymore at the viewport borders.
|
|
128
|
+
const overscanLineLimit = Math.ceil(OVERSCAN_CHAR_LIMIT / this._bufferService.cols);
|
|
129
|
+
const iterator = this._bufferService.buffer.iterator(
|
|
130
|
+
false, absoluteRowIndexStart, absoluteRowIndexEnd, overscanLineLimit, overscanLineLimit);
|
|
131
|
+
while (iterator.hasNext()) {
|
|
132
|
+
const lineData: IBufferStringIteratorResult = iterator.next();
|
|
133
|
+
for (let i = 0; i < this._linkMatchers.length; i++) {
|
|
134
|
+
this._doLinkifyRow(lineData.range.first, lineData.content, this._linkMatchers[i]);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this._rowsToLinkify.start = undefined;
|
|
139
|
+
this._rowsToLinkify.end = undefined;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Registers a link matcher, allowing custom link patterns to be matched and
|
|
144
|
+
* handled.
|
|
145
|
+
* @param regex The regular expression to search for. Specifically, this
|
|
146
|
+
* searches the textContent of the rows. You will want to use \s to match a
|
|
147
|
+
* space ' ' character for example.
|
|
148
|
+
* @param handler The callback when the link is called.
|
|
149
|
+
* @param options Options for the link matcher.
|
|
150
|
+
* @return The ID of the new matcher, this can be used to deregister.
|
|
151
|
+
*/
|
|
152
|
+
public registerLinkMatcher(regex: RegExp, handler: LinkMatcherHandler, options: ILinkMatcherOptions = {}): number {
|
|
153
|
+
if (!handler) {
|
|
154
|
+
throw new Error('handler must be defined');
|
|
155
|
+
}
|
|
156
|
+
const matcher: IRegisteredLinkMatcher = {
|
|
157
|
+
id: this._nextLinkMatcherId++,
|
|
158
|
+
regex,
|
|
159
|
+
handler,
|
|
160
|
+
matchIndex: options.matchIndex,
|
|
161
|
+
validationCallback: options.validationCallback,
|
|
162
|
+
hoverTooltipCallback: options.tooltipCallback,
|
|
163
|
+
hoverLeaveCallback: options.leaveCallback,
|
|
164
|
+
willLinkActivate: options.willLinkActivate,
|
|
165
|
+
priority: options.priority || 0
|
|
166
|
+
};
|
|
167
|
+
this._addLinkMatcherToList(matcher);
|
|
168
|
+
return matcher.id;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Inserts a link matcher to the list in the correct position based on the
|
|
173
|
+
* priority of each link matcher. New link matchers of equal priority are
|
|
174
|
+
* considered after older link matchers.
|
|
175
|
+
* @param matcher The link matcher to be added.
|
|
176
|
+
*/
|
|
177
|
+
private _addLinkMatcherToList(matcher: IRegisteredLinkMatcher): void {
|
|
178
|
+
if (this._linkMatchers.length === 0) {
|
|
179
|
+
this._linkMatchers.push(matcher);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
for (let i = this._linkMatchers.length - 1; i >= 0; i--) {
|
|
184
|
+
if (matcher.priority <= this._linkMatchers[i].priority) {
|
|
185
|
+
this._linkMatchers.splice(i + 1, 0, matcher);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
this._linkMatchers.splice(0, 0, matcher);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Deregisters a link matcher if it has been registered.
|
|
195
|
+
* @param matcherId The link matcher's ID (returned after register)
|
|
196
|
+
* @return Whether a link matcher was found and deregistered.
|
|
197
|
+
*/
|
|
198
|
+
public deregisterLinkMatcher(matcherId: number): boolean {
|
|
199
|
+
for (let i = 0; i < this._linkMatchers.length; i++) {
|
|
200
|
+
if (this._linkMatchers[i].id === matcherId) {
|
|
201
|
+
this._linkMatchers.splice(i, 1);
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Linkifies a row given a specific handler.
|
|
210
|
+
* @param rowIndex The row index to linkify (absolute index).
|
|
211
|
+
* @param text string content of the unwrapped row.
|
|
212
|
+
* @param matcher The link matcher for this line.
|
|
213
|
+
*/
|
|
214
|
+
private _doLinkifyRow(rowIndex: number, text: string, matcher: ILinkMatcher): void {
|
|
215
|
+
// clone regex to do a global search on text
|
|
216
|
+
const rex = new RegExp(matcher.regex.source, (matcher.regex.flags || '') + 'g');
|
|
217
|
+
let match;
|
|
218
|
+
let stringIndex = -1;
|
|
219
|
+
while ((match = rex.exec(text)) !== null) {
|
|
220
|
+
const uri = match[typeof matcher.matchIndex !== 'number' ? 0 : matcher.matchIndex];
|
|
221
|
+
if (!uri) {
|
|
222
|
+
// something matched but does not comply with the given matchIndex
|
|
223
|
+
// since this is most likely a bug the regex itself we simply do nothing here
|
|
224
|
+
this._logService.debug('match found without corresponding matchIndex', match, matcher);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Get index, match.index is for the outer match which includes negated chars
|
|
229
|
+
// therefore we cannot use match.index directly, instead we search the position
|
|
230
|
+
// of the match group in text again
|
|
231
|
+
// also correct regex and string search offsets for the next loop run
|
|
232
|
+
stringIndex = text.indexOf(uri, stringIndex + 1);
|
|
233
|
+
rex.lastIndex = stringIndex + uri.length;
|
|
234
|
+
if (stringIndex < 0) {
|
|
235
|
+
// invalid stringIndex (should not have happened)
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// get the buffer index as [absolute row, col] for the match
|
|
240
|
+
const bufferIndex = this._bufferService.buffer.stringIndexToBufferIndex(rowIndex, stringIndex);
|
|
241
|
+
if (bufferIndex[0] < 0) {
|
|
242
|
+
// invalid bufferIndex (should not have happened)
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const line = this._bufferService.buffer.lines.get(bufferIndex[0]);
|
|
247
|
+
if (!line) {
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const attr = line.getFg(bufferIndex[1]);
|
|
252
|
+
const fg = attr ? (attr >> 9) & 0x1ff : undefined;
|
|
253
|
+
|
|
254
|
+
if (matcher.validationCallback) {
|
|
255
|
+
matcher.validationCallback(uri, isValid => {
|
|
256
|
+
// Discard link if the line has already changed
|
|
257
|
+
if (this._rowsTimeoutId) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (isValid) {
|
|
261
|
+
this._addLink(bufferIndex[1], bufferIndex[0] - this._bufferService.buffer.ydisp, uri, matcher, fg);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
} else {
|
|
265
|
+
this._addLink(bufferIndex[1], bufferIndex[0] - this._bufferService.buffer.ydisp, uri, matcher, fg);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Registers a link to the mouse zone manager.
|
|
272
|
+
* @param x The column the link starts.
|
|
273
|
+
* @param y The row the link is on.
|
|
274
|
+
* @param uri The URI of the link.
|
|
275
|
+
* @param matcher The link matcher for the link.
|
|
276
|
+
* @param fg The link color for hover event.
|
|
277
|
+
*/
|
|
278
|
+
private _addLink(x: number, y: number, uri: string, matcher: ILinkMatcher, fg: number | undefined): void {
|
|
279
|
+
if (!this._mouseZoneManager || !this._element) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
// FIXME: get cell length from buffer to avoid mismatch after Unicode version change
|
|
283
|
+
const width = this._unicodeService.getStringCellWidth(uri);
|
|
284
|
+
const x1 = x % this._bufferService.cols;
|
|
285
|
+
const y1 = y + Math.floor(x / this._bufferService.cols);
|
|
286
|
+
let x2 = (x1 + width) % this._bufferService.cols;
|
|
287
|
+
let y2 = y1 + Math.floor((x1 + width) / this._bufferService.cols);
|
|
288
|
+
if (x2 === 0) {
|
|
289
|
+
x2 = this._bufferService.cols;
|
|
290
|
+
y2--;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this._mouseZoneManager.add(new MouseZone(
|
|
294
|
+
x1 + 1,
|
|
295
|
+
y1 + 1,
|
|
296
|
+
x2 + 1,
|
|
297
|
+
y2 + 1,
|
|
298
|
+
e => {
|
|
299
|
+
if (matcher.handler) {
|
|
300
|
+
return matcher.handler(e, uri);
|
|
301
|
+
}
|
|
302
|
+
const newWindow = window.open();
|
|
303
|
+
if (newWindow) {
|
|
304
|
+
newWindow.opener = null;
|
|
305
|
+
newWindow.location.href = uri;
|
|
306
|
+
} else {
|
|
307
|
+
console.warn('Opening link blocked as opener could not be cleared');
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
() => {
|
|
311
|
+
this._onShowLinkUnderline.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg));
|
|
312
|
+
this._element!.classList.add('xterm-cursor-pointer');
|
|
313
|
+
},
|
|
314
|
+
e => {
|
|
315
|
+
this._onLinkTooltip.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg));
|
|
316
|
+
if (matcher.hoverTooltipCallback) {
|
|
317
|
+
// Note that IViewportRange use 1-based coordinates to align with escape sequences such
|
|
318
|
+
// as CUP which use 1,1 as the default for row/col
|
|
319
|
+
matcher.hoverTooltipCallback(e, uri, { start: { x: x1, y: y1 }, end: { x: x2, y: y2 } });
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
() => {
|
|
323
|
+
this._onHideLinkUnderline.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg));
|
|
324
|
+
this._element!.classList.remove('xterm-cursor-pointer');
|
|
325
|
+
if (matcher.hoverLeaveCallback) {
|
|
326
|
+
matcher.hoverLeaveCallback();
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
e => {
|
|
330
|
+
if (matcher.willLinkActivate) {
|
|
331
|
+
return matcher.willLinkActivate(e, uri);
|
|
332
|
+
}
|
|
333
|
+
return true;
|
|
334
|
+
}
|
|
335
|
+
));
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
private _createLinkHoverEvent(x1: number, y1: number, x2: number, y2: number, fg: number | undefined): ILinkifierEvent {
|
|
339
|
+
return { x1, y1, x2, y2, cols: this._bufferService.cols, fg };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export class MouseZone implements IMouseZone {
|
|
344
|
+
constructor(
|
|
345
|
+
public x1: number,
|
|
346
|
+
public y1: number,
|
|
347
|
+
public x2: number,
|
|
348
|
+
public y2: number,
|
|
349
|
+
public clickCallback: (e: MouseEvent) => any,
|
|
350
|
+
public hoverCallback: (e: MouseEvent) => any,
|
|
351
|
+
public tooltipCallback: (e: MouseEvent) => any,
|
|
352
|
+
public leaveCallback: () => void,
|
|
353
|
+
public willLinkActivate: (e: MouseEvent) => boolean
|
|
354
|
+
) {
|
|
355
|
+
}
|
|
356
|
+
}
|