@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.
Files changed (135) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/xterm/LICENSE +21 -0
  3. package/dist/lib/xterm/README.md +225 -0
  4. package/dist/lib/xterm/css/xterm.css +190 -0
  5. package/dist/lib/xterm/lib/xterm.js +2 -0
  6. package/dist/lib/xterm/lib/xterm.js.map +1 -0
  7. package/dist/lib/xterm/package.json +90 -0
  8. package/dist/lib/xterm/src/browser/AccessibilityManager.ts +301 -0
  9. package/dist/lib/xterm/src/browser/Clipboard.ts +99 -0
  10. package/dist/lib/xterm/src/browser/ColorContrastCache.ts +39 -0
  11. package/dist/lib/xterm/src/browser/ColorManager.ts +268 -0
  12. package/dist/lib/xterm/src/browser/Dom.ts +10 -0
  13. package/dist/lib/xterm/src/browser/Lifecycle.ts +30 -0
  14. package/dist/lib/xterm/src/browser/Linkifier.ts +356 -0
  15. package/dist/lib/xterm/src/browser/Linkifier2.ts +397 -0
  16. package/dist/lib/xterm/src/browser/LocalizableStrings.ts +10 -0
  17. package/dist/lib/xterm/src/browser/MouseZoneManager.ts +236 -0
  18. package/dist/lib/xterm/src/browser/RenderDebouncer.ts +82 -0
  19. package/dist/lib/xterm/src/browser/ScreenDprMonitor.ts +69 -0
  20. package/dist/lib/xterm/src/browser/Terminal.ts +1447 -0
  21. package/dist/lib/xterm/src/browser/TimeBasedDebouncer.ts +86 -0
  22. package/dist/lib/xterm/src/browser/Types.d.ts +317 -0
  23. package/dist/lib/xterm/src/browser/Viewport.ts +276 -0
  24. package/dist/lib/xterm/src/browser/decorations/BufferDecorationRenderer.ts +131 -0
  25. package/dist/lib/xterm/src/browser/decorations/ColorZoneStore.ts +117 -0
  26. package/dist/lib/xterm/src/browser/decorations/OverviewRulerRenderer.ts +228 -0
  27. package/dist/lib/xterm/src/browser/input/CompositionHelper.ts +237 -0
  28. package/dist/lib/xterm/src/browser/input/Mouse.ts +64 -0
  29. package/dist/lib/xterm/src/browser/input/MoveToCell.ts +249 -0
  30. package/dist/lib/xterm/src/browser/public/Terminal.ts +298 -0
  31. package/dist/lib/xterm/src/browser/renderer/BaseRenderLayer.ts +582 -0
  32. package/dist/lib/xterm/src/browser/renderer/CursorRenderLayer.ts +378 -0
  33. package/dist/lib/xterm/src/browser/renderer/CustomGlyphs.ts +632 -0
  34. package/dist/lib/xterm/src/browser/renderer/GridCache.ts +33 -0
  35. package/dist/lib/xterm/src/browser/renderer/LinkRenderLayer.ts +84 -0
  36. package/dist/lib/xterm/src/browser/renderer/Renderer.ts +219 -0
  37. package/dist/lib/xterm/src/browser/renderer/RendererUtils.ts +26 -0
  38. package/dist/lib/xterm/src/browser/renderer/SelectionRenderLayer.ts +131 -0
  39. package/dist/lib/xterm/src/browser/renderer/TextRenderLayer.ts +344 -0
  40. package/dist/lib/xterm/src/browser/renderer/Types.d.ts +109 -0
  41. package/dist/lib/xterm/src/browser/renderer/atlas/BaseCharAtlas.ts +58 -0
  42. package/dist/lib/xterm/src/browser/renderer/atlas/CharAtlasCache.ts +95 -0
  43. package/dist/lib/xterm/src/browser/renderer/atlas/CharAtlasUtils.ts +54 -0
  44. package/dist/lib/xterm/src/browser/renderer/atlas/Constants.ts +15 -0
  45. package/dist/lib/xterm/src/browser/renderer/atlas/DynamicCharAtlas.ts +404 -0
  46. package/dist/lib/xterm/src/browser/renderer/atlas/LRUMap.ts +136 -0
  47. package/dist/lib/xterm/src/browser/renderer/atlas/Types.d.ts +29 -0
  48. package/dist/lib/xterm/src/browser/renderer/dom/DomRenderer.ts +403 -0
  49. package/dist/lib/xterm/src/browser/renderer/dom/DomRendererRowFactory.ts +344 -0
  50. package/dist/lib/xterm/src/browser/selection/SelectionModel.ts +144 -0
  51. package/dist/lib/xterm/src/browser/selection/Types.d.ts +15 -0
  52. package/dist/lib/xterm/src/browser/services/CharSizeService.ts +87 -0
  53. package/dist/lib/xterm/src/browser/services/CharacterJoinerService.ts +339 -0
  54. package/dist/lib/xterm/src/browser/services/CoreBrowserService.ts +20 -0
  55. package/dist/lib/xterm/src/browser/services/MouseService.ts +36 -0
  56. package/dist/lib/xterm/src/browser/services/RenderService.ts +237 -0
  57. package/dist/lib/xterm/src/browser/services/SelectionService.ts +1027 -0
  58. package/dist/lib/xterm/src/browser/services/Services.ts +123 -0
  59. package/dist/lib/xterm/src/browser/services/SoundService.ts +63 -0
  60. package/dist/lib/xterm/src/common/CircularList.ts +239 -0
  61. package/dist/lib/xterm/src/common/Clone.ts +23 -0
  62. package/dist/lib/xterm/src/common/Color.ts +285 -0
  63. package/dist/lib/xterm/src/common/CoreTerminal.ts +300 -0
  64. package/dist/lib/xterm/src/common/EventEmitter.ts +69 -0
  65. package/dist/lib/xterm/src/common/InputHandler.ts +3230 -0
  66. package/dist/lib/xterm/src/common/Lifecycle.ts +68 -0
  67. package/dist/lib/xterm/src/common/Platform.ts +31 -0
  68. package/dist/lib/xterm/src/common/SortedList.ts +88 -0
  69. package/dist/lib/xterm/src/common/TypedArrayUtils.ts +50 -0
  70. package/dist/lib/xterm/src/common/Types.d.ts +489 -0
  71. package/dist/lib/xterm/src/common/WindowsMode.ts +27 -0
  72. package/dist/lib/xterm/src/common/buffer/AttributeData.ts +148 -0
  73. package/dist/lib/xterm/src/common/buffer/Buffer.ts +711 -0
  74. package/dist/lib/xterm/src/common/buffer/BufferLine.ts +441 -0
  75. package/dist/lib/xterm/src/common/buffer/BufferRange.ts +13 -0
  76. package/dist/lib/xterm/src/common/buffer/BufferReflow.ts +220 -0
  77. package/dist/lib/xterm/src/common/buffer/BufferSet.ts +131 -0
  78. package/dist/lib/xterm/src/common/buffer/CellData.ts +94 -0
  79. package/dist/lib/xterm/src/common/buffer/Constants.ts +139 -0
  80. package/dist/lib/xterm/src/common/buffer/Marker.ts +37 -0
  81. package/dist/lib/xterm/src/common/buffer/Types.d.ts +64 -0
  82. package/dist/lib/xterm/src/common/data/Charsets.ts +256 -0
  83. package/dist/lib/xterm/src/common/data/EscapeSequences.ts +153 -0
  84. package/dist/lib/xterm/src/common/input/Keyboard.ts +398 -0
  85. package/dist/lib/xterm/src/common/input/TextDecoder.ts +346 -0
  86. package/dist/lib/xterm/src/common/input/UnicodeV6.ts +133 -0
  87. package/dist/lib/xterm/src/common/input/WriteBuffer.ts +229 -0
  88. package/dist/lib/xterm/src/common/input/XParseColor.ts +80 -0
  89. package/dist/lib/xterm/src/common/parser/Constants.ts +58 -0
  90. package/dist/lib/xterm/src/common/parser/DcsParser.ts +192 -0
  91. package/dist/lib/xterm/src/common/parser/EscapeSequenceParser.ts +796 -0
  92. package/dist/lib/xterm/src/common/parser/OscParser.ts +238 -0
  93. package/dist/lib/xterm/src/common/parser/Params.ts +229 -0
  94. package/dist/lib/xterm/src/common/parser/Types.d.ts +274 -0
  95. package/dist/lib/xterm/src/common/public/AddonManager.ts +56 -0
  96. package/dist/lib/xterm/src/common/public/BufferApiView.ts +35 -0
  97. package/dist/lib/xterm/src/common/public/BufferLineApiView.ts +29 -0
  98. package/dist/lib/xterm/src/common/public/BufferNamespaceApi.ts +33 -0
  99. package/dist/lib/xterm/src/common/public/ParserApi.ts +37 -0
  100. package/dist/lib/xterm/src/common/public/UnicodeApi.ts +27 -0
  101. package/dist/lib/xterm/src/common/services/BufferService.ts +185 -0
  102. package/dist/lib/xterm/src/common/services/CharsetService.ts +34 -0
  103. package/dist/lib/xterm/src/common/services/CoreMouseService.ts +309 -0
  104. package/dist/lib/xterm/src/common/services/CoreService.ts +92 -0
  105. package/dist/lib/xterm/src/common/services/DecorationService.ts +139 -0
  106. package/dist/lib/xterm/src/common/services/DirtyRowService.ts +53 -0
  107. package/dist/lib/xterm/src/common/services/InstantiationService.ts +83 -0
  108. package/dist/lib/xterm/src/common/services/LogService.ts +88 -0
  109. package/dist/lib/xterm/src/common/services/OptionsService.ts +178 -0
  110. package/dist/lib/xterm/src/common/services/ServiceRegistry.ts +49 -0
  111. package/dist/lib/xterm/src/common/services/Services.ts +323 -0
  112. package/dist/lib/xterm/src/common/services/UnicodeService.ts +82 -0
  113. package/dist/lib/xterm/src/headless/Terminal.ts +170 -0
  114. package/dist/lib/xterm/src/headless/Types.d.ts +31 -0
  115. package/dist/lib/xterm/src/headless/public/Terminal.ts +216 -0
  116. package/dist/lib/xterm/typings/xterm.d.ts +1872 -0
  117. package/dist/lib/xterm-fit/LICENSE +19 -0
  118. package/dist/lib/xterm-fit/README.md +24 -0
  119. package/dist/lib/xterm-fit/lib/xterm-addon-fit.js +2 -0
  120. package/dist/lib/xterm-fit/lib/xterm-addon-fit.js.map +1 -0
  121. package/dist/lib/xterm-fit/out/FitAddon.js +58 -0
  122. package/dist/lib/xterm-fit/out/FitAddon.js.map +1 -0
  123. package/dist/lib/xterm-fit/out-test/FitAddon.api.js.map +1 -0
  124. package/dist/lib/xterm-fit/package.json +21 -0
  125. package/dist/lib/xterm-fit/src/FitAddon.ts +86 -0
  126. package/dist/lib/xterm-fit/typings/xterm-addon-fit.d.ts +55 -0
  127. package/dist/lib/xterm-links/LICENSE +19 -0
  128. package/dist/lib/xterm-links/README.md +21 -0
  129. package/dist/lib/xterm-links/lib/xterm-addon-web-links.js +2 -0
  130. package/dist/lib/xterm-links/lib/xterm-addon-web-links.js.map +1 -0
  131. package/dist/lib/xterm-links/package.json +26 -0
  132. package/dist/lib/xterm-links/src/WebLinkProvider.ts +145 -0
  133. package/dist/lib/xterm-links/src/WebLinksAddon.ts +77 -0
  134. package/dist/lib/xterm-links/typings/xterm-addon-web-links.d.ts +58 -0
  135. package/package.json +1 -1
@@ -0,0 +1,323 @@
1
+ /**
2
+ * Copyright (c) 2019 The xterm.js authors. All rights reserved.
3
+ * @license MIT
4
+ */
5
+
6
+ import { IEvent, IEventEmitter } from 'common/EventEmitter';
7
+ import { IBuffer, IBufferSet } from 'common/buffer/Types';
8
+ import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes, IAttributeData, ScrollSource, IDisposable, IColorRGB, IColor } from 'common/Types';
9
+ import { createDecorator } from 'common/services/ServiceRegistry';
10
+ import { IDecorationOptions, IDecoration } from 'xterm';
11
+
12
+ export const IBufferService = createDecorator<IBufferService>('BufferService');
13
+ export interface IBufferService {
14
+ serviceBrand: undefined;
15
+
16
+ readonly cols: number;
17
+ readonly rows: number;
18
+ readonly buffer: IBuffer;
19
+ readonly buffers: IBufferSet;
20
+ isUserScrolling: boolean;
21
+ onResize: IEvent<{ cols: number, rows: number }>;
22
+ onScroll: IEvent<number>;
23
+ scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
24
+ scrollToBottom(): void;
25
+ scrollToTop(): void;
26
+ scrollToLine(line: number): void;
27
+ scrollLines(disp: number, suppressScrollEvent?: boolean, source?: ScrollSource): void;
28
+ scrollPages(pageCount: number): void;
29
+ resize(cols: number, rows: number): void;
30
+ reset(): void;
31
+ }
32
+
33
+ export const ICoreMouseService = createDecorator<ICoreMouseService>('CoreMouseService');
34
+ export interface ICoreMouseService {
35
+ activeProtocol: string;
36
+ activeEncoding: string;
37
+ areMouseEventsActive: boolean;
38
+ addProtocol(name: string, protocol: ICoreMouseProtocol): void;
39
+ addEncoding(name: string, encoding: CoreMouseEncoding): void;
40
+ reset(): void;
41
+
42
+ /**
43
+ * Triggers a mouse event to be sent.
44
+ *
45
+ * Returns true if the event passed all protocol restrictions and a report
46
+ * was sent, otherwise false. The return value may be used to decide whether
47
+ * the default event action in the bowser component should be omitted.
48
+ *
49
+ * Note: The method will change values of the given event object
50
+ * to fullfill protocol and encoding restrictions.
51
+ */
52
+ triggerMouseEvent(event: ICoreMouseEvent): boolean;
53
+
54
+ /**
55
+ * Event to announce changes in mouse tracking.
56
+ */
57
+ onProtocolChange: IEvent<CoreMouseEventType>;
58
+
59
+ /**
60
+ * Human readable version of mouse events.
61
+ */
62
+ explainEvents(events: CoreMouseEventType): { [event: string]: boolean };
63
+ }
64
+
65
+ export const ICoreService = createDecorator<ICoreService>('CoreService');
66
+ export interface ICoreService {
67
+ serviceBrand: undefined;
68
+
69
+ /**
70
+ * Initially the cursor will not be visible until the first time the terminal
71
+ * is focused.
72
+ */
73
+ isCursorInitialized: boolean;
74
+ isCursorHidden: boolean;
75
+
76
+ readonly modes: IModes;
77
+ readonly decPrivateModes: IDecPrivateModes;
78
+
79
+ readonly onData: IEvent<string>;
80
+ readonly onUserInput: IEvent<void>;
81
+ readonly onBinary: IEvent<string>;
82
+
83
+ reset(): void;
84
+
85
+ /**
86
+ * Triggers the onData event in the public API.
87
+ * @param data The data that is being emitted.
88
+ * @param wasFromUser Whether the data originated from the user (as opposed to
89
+ * resulting from parsing incoming data). When true this will also:
90
+ * - Scroll to the bottom of the buffer.s
91
+ * - Fire the `onUserInput` event (so selection can be cleared).
92
+ */
93
+ triggerDataEvent(data: string, wasUserInput?: boolean): void;
94
+
95
+ /**
96
+ * Triggers the onBinary event in the public API.
97
+ * @param data The data that is being emitted.
98
+ */
99
+ triggerBinaryEvent(data: string): void;
100
+ }
101
+
102
+ export const ICharsetService = createDecorator<ICharsetService>('CharsetService');
103
+ export interface ICharsetService {
104
+ serviceBrand: undefined;
105
+
106
+ charset: ICharset | undefined;
107
+ readonly glevel: number;
108
+
109
+ reset(): void;
110
+
111
+ /**
112
+ * Set the G level of the terminal.
113
+ * @param g
114
+ */
115
+ setgLevel(g: number): void;
116
+
117
+ /**
118
+ * Set the charset for the given G level of the terminal.
119
+ * @param g
120
+ * @param charset
121
+ */
122
+ setgCharset(g: number, charset: ICharset | undefined): void;
123
+ }
124
+
125
+ export const IDirtyRowService = createDecorator<IDirtyRowService>('DirtyRowService');
126
+ export interface IDirtyRowService {
127
+ serviceBrand: undefined;
128
+
129
+ readonly start: number;
130
+ readonly end: number;
131
+
132
+ clearRange(): void;
133
+ markDirty(y: number): void;
134
+ markRangeDirty(y1: number, y2: number): void;
135
+ markAllDirty(): void;
136
+ }
137
+
138
+ export interface IServiceIdentifier<T> {
139
+ (...args: any[]): void;
140
+ type: T;
141
+ }
142
+
143
+ export interface IBrandedService {
144
+ serviceBrand: undefined;
145
+ }
146
+
147
+ type GetLeadingNonServiceArgs<Args> =
148
+ Args extends [...IBrandedService[]] ? []
149
+ : Args extends [infer A1, ...IBrandedService[]] ? [A1]
150
+ : Args extends [infer A1, infer A2, ...IBrandedService[]] ? [A1, A2]
151
+ : Args extends [infer A1, infer A2, infer A3, ...IBrandedService[]] ? [A1, A2, A3]
152
+ : Args extends [infer A1, infer A2, infer A3, infer A4, ...IBrandedService[]] ? [A1, A2, A3, A4]
153
+ : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, ...IBrandedService[]] ? [A1, A2, A3, A4, A5]
154
+ : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6]
155
+ : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6, A7]
156
+ : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7, infer A8, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6, A7, A8]
157
+ : never;
158
+
159
+ export const IInstantiationService = createDecorator<IInstantiationService>('InstantiationService');
160
+ export interface IInstantiationService {
161
+ serviceBrand: undefined;
162
+
163
+ setService<T>(id: IServiceIdentifier<T>, instance: T): void;
164
+ getService<T>(id: IServiceIdentifier<T>): T | undefined;
165
+ createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(t: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;
166
+ }
167
+
168
+ export enum LogLevelEnum {
169
+ DEBUG = 0,
170
+ INFO = 1,
171
+ WARN = 2,
172
+ ERROR = 3,
173
+ OFF = 4
174
+ }
175
+
176
+ export const ILogService = createDecorator<ILogService>('LogService');
177
+ export interface ILogService {
178
+ serviceBrand: undefined;
179
+
180
+ logLevel: LogLevelEnum;
181
+
182
+ debug(message: any, ...optionalParams: any[]): void;
183
+ info(message: any, ...optionalParams: any[]): void;
184
+ warn(message: any, ...optionalParams: any[]): void;
185
+ error(message: any, ...optionalParams: any[]): void;
186
+ }
187
+
188
+ export const IOptionsService = createDecorator<IOptionsService>('OptionsService');
189
+ export interface IOptionsService {
190
+ serviceBrand: undefined;
191
+
192
+ /**
193
+ * Read only access to the raw options object, this is an internal-only fast path for accessing
194
+ * single options without any validation as we trust TypeScript to enforce correct usage
195
+ * internally.
196
+ */
197
+ readonly rawOptions: Readonly<ITerminalOptions>;
198
+ readonly options: ITerminalOptions;
199
+
200
+ readonly onOptionChange: IEvent<string>;
201
+
202
+ setOption<T>(key: string, value: T): void;
203
+ getOption<T>(key: string): T | undefined;
204
+ }
205
+
206
+ export type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;
207
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';
208
+
209
+ export type RendererType = 'dom' | 'canvas';
210
+
211
+ export interface ITerminalOptions {
212
+ allowProposedApi: boolean;
213
+ allowTransparency: boolean;
214
+ altClickMovesCursor: boolean;
215
+ bellSound: string;
216
+ bellStyle: 'none' | 'sound' /* | 'visual' | 'both' */;
217
+ cols: number;
218
+ convertEol: boolean;
219
+ cursorBlink: boolean;
220
+ cursorStyle: 'block' | 'underline' | 'bar';
221
+ cursorWidth: number;
222
+ customGlyphs: boolean;
223
+ disableStdin: boolean;
224
+ drawBoldTextInBrightColors: boolean;
225
+ fastScrollModifier: 'alt' | 'ctrl' | 'shift' | undefined;
226
+ fastScrollSensitivity: number;
227
+ fontSize: number;
228
+ fontFamily: string;
229
+ fontWeight: FontWeight;
230
+ fontWeightBold: FontWeight;
231
+ letterSpacing: number;
232
+ lineHeight: number;
233
+ linkTooltipHoverDuration: number;
234
+ logLevel: LogLevel;
235
+ macOptionIsMeta: boolean;
236
+ macOptionClickForcesSelection: boolean;
237
+ minimumContrastRatio: number;
238
+ rendererType: RendererType;
239
+ rightClickSelectsWord: boolean;
240
+ rows: number;
241
+ screenReaderMode: boolean;
242
+ scrollback: number;
243
+ scrollSensitivity: number;
244
+ tabStopWidth: number;
245
+ theme: ITheme;
246
+ windowsMode: boolean;
247
+ windowOptions: IWindowOptions;
248
+ wordSeparator: string;
249
+ overviewRulerWidth?: number;
250
+
251
+ [key: string]: any;
252
+ cancelEvents: boolean;
253
+ termName: string;
254
+ }
255
+
256
+ export interface ITheme {
257
+ foreground?: string;
258
+ background?: string;
259
+ cursor?: string;
260
+ cursorAccent?: string;
261
+ selection?: string;
262
+ selectionForeground?: string;
263
+ black?: string;
264
+ red?: string;
265
+ green?: string;
266
+ yellow?: string;
267
+ blue?: string;
268
+ magenta?: string;
269
+ cyan?: string;
270
+ white?: string;
271
+ brightBlack?: string;
272
+ brightRed?: string;
273
+ brightGreen?: string;
274
+ brightYellow?: string;
275
+ brightBlue?: string;
276
+ brightMagenta?: string;
277
+ brightCyan?: string;
278
+ brightWhite?: string;
279
+ }
280
+
281
+ export const IUnicodeService = createDecorator<IUnicodeService>('UnicodeService');
282
+ export interface IUnicodeService {
283
+ serviceBrand: undefined;
284
+ /** Register an Unicode version provider. */
285
+ register(provider: IUnicodeVersionProvider): void;
286
+ /** Registered Unicode versions. */
287
+ readonly versions: string[];
288
+ /** Currently active version. */
289
+ activeVersion: string;
290
+ /** Event triggered, when activate version changed. */
291
+ readonly onChange: IEvent<string>;
292
+
293
+ /**
294
+ * Unicode version dependent
295
+ */
296
+ wcwidth(codepoint: number): number;
297
+ getStringCellWidth(s: string): number;
298
+ }
299
+
300
+ export interface IUnicodeVersionProvider {
301
+ readonly version: string;
302
+ wcwidth(ucs: number): 0 | 1 | 2;
303
+ }
304
+
305
+ export const IDecorationService = createDecorator<IDecorationService>('DecorationService');
306
+ export interface IDecorationService extends IDisposable {
307
+ serviceBrand: undefined;
308
+ readonly decorations: IterableIterator<IInternalDecoration>;
309
+ readonly onDecorationRegistered: IEvent<IInternalDecoration>;
310
+ readonly onDecorationRemoved: IEvent<IInternalDecoration>;
311
+ registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
312
+ reset(): void;
313
+ /** Iterates over the decorations at a line (in no particular order). */
314
+ getDecorationsAtLine(line: number): IterableIterator<IInternalDecoration>;
315
+ /** Iterates over the decorations at a cell (in no particular order). */
316
+ getDecorationsAtCell(x: number, line: number, layer?: 'bottom' | 'top'): IterableIterator<IInternalDecoration>;
317
+ }
318
+ export interface IInternalDecoration extends IDecoration {
319
+ readonly options: IDecorationOptions;
320
+ readonly backgroundColorRGB: IColor | undefined;
321
+ readonly foregroundColorRGB: IColor | undefined;
322
+ readonly onRenderEmitter: IEventEmitter<HTMLElement>;
323
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Copyright (c) 2019 The xterm.js authors. All rights reserved.
3
+ * @license MIT
4
+ */
5
+ import { IUnicodeService, IUnicodeVersionProvider } from 'common/services/Services';
6
+ import { EventEmitter, IEvent } from 'common/EventEmitter';
7
+ import { UnicodeV6 } from 'common/input/UnicodeV6';
8
+
9
+
10
+ export class UnicodeService implements IUnicodeService {
11
+ public serviceBrand: any;
12
+
13
+ private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);
14
+ private _active: string = '';
15
+ private _activeProvider: IUnicodeVersionProvider;
16
+ private _onChange = new EventEmitter<string>();
17
+ public get onChange(): IEvent<string> { return this._onChange.event; }
18
+
19
+ constructor() {
20
+ const defaultProvider = new UnicodeV6();
21
+ this.register(defaultProvider);
22
+ this._active = defaultProvider.version;
23
+ this._activeProvider = defaultProvider;
24
+ }
25
+
26
+ public get versions(): string[] {
27
+ return Object.keys(this._providers);
28
+ }
29
+
30
+ public get activeVersion(): string {
31
+ return this._active;
32
+ }
33
+
34
+ public set activeVersion(version: string) {
35
+ if (!this._providers[version]) {
36
+ throw new Error(`unknown Unicode version "${version}"`);
37
+ }
38
+ this._active = version;
39
+ this._activeProvider = this._providers[version];
40
+ this._onChange.fire(version);
41
+ }
42
+
43
+ public register(provider: IUnicodeVersionProvider): void {
44
+ this._providers[provider.version] = provider;
45
+ }
46
+
47
+ /**
48
+ * Unicode version dependent interface.
49
+ */
50
+ public wcwidth(num: number): number {
51
+ return this._activeProvider.wcwidth(num);
52
+ }
53
+
54
+ public getStringCellWidth(s: string): number {
55
+ let result = 0;
56
+ const length = s.length;
57
+ for (let i = 0; i < length; ++i) {
58
+ let code = s.charCodeAt(i);
59
+ // surrogate pair first
60
+ if (0xD800 <= code && code <= 0xDBFF) {
61
+ if (++i >= length) {
62
+ // this should not happen with strings retrieved from
63
+ // Buffer.translateToString as it converts from UTF-32
64
+ // and therefore always should contain the second part
65
+ // for any other string we still have to handle it somehow:
66
+ // simply treat the lonely surrogate first as a single char (UCS-2 behavior)
67
+ return result + this.wcwidth(code);
68
+ }
69
+ const second = s.charCodeAt(i);
70
+ // convert surrogate pair to high codepoint only for valid second part (UTF-16)
71
+ // otherwise treat them independently (UCS-2 behavior)
72
+ if (0xDC00 <= second && second <= 0xDFFF) {
73
+ code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
74
+ } else {
75
+ result += this.wcwidth(second);
76
+ }
77
+ }
78
+ result += this.wcwidth(code);
79
+ }
80
+ return result;
81
+ }
82
+ }
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
+ * @license MIT
5
+ *
6
+ * Originally forked from (with the author's permission):
7
+ * Fabrice Bellard's javascript vt100 for jslinux:
8
+ * http://bellard.org/jslinux/
9
+ * Copyright (c) 2011 Fabrice Bellard
10
+ * The original design remains. The terminal itself
11
+ * has been extended to include xterm CSI codes, among
12
+ * other features.
13
+ *
14
+ * Terminal Emulation References:
15
+ * http://vt100.net/
16
+ * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt
17
+ * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
18
+ * http://invisible-island.net/vttest/
19
+ * http://www.inwap.com/pdp10/ansicode.txt
20
+ * http://linux.die.net/man/4/console_codes
21
+ * http://linux.die.net/man/7/urxvt
22
+ */
23
+
24
+ import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
25
+ import { IBuffer } from 'common/buffer/Types';
26
+ import { CoreTerminal } from 'common/CoreTerminal';
27
+ import { EventEmitter, forwardEvent, IEvent } from 'common/EventEmitter';
28
+ import { ITerminalOptions as IInitializedTerminalOptions } from 'common/services/Services';
29
+ import { IMarker, ITerminalOptions, ScrollSource } from 'common/Types';
30
+
31
+ export class Terminal extends CoreTerminal {
32
+ // TODO: We should remove options once components adopt optionsService
33
+ public get options(): IInitializedTerminalOptions { return this.optionsService.options; }
34
+
35
+ private _onBell = new EventEmitter<void>();
36
+ public get onBell(): IEvent<void> { return this._onBell.event; }
37
+ private _onCursorMove = new EventEmitter<void>();
38
+ public get onCursorMove(): IEvent<void> { return this._onCursorMove.event; }
39
+ private _onTitleChange = new EventEmitter<string>();
40
+ public get onTitleChange(): IEvent<string> { return this._onTitleChange.event; }
41
+
42
+ private _onA11yCharEmitter = new EventEmitter<string>();
43
+ public get onA11yChar(): IEvent<string> { return this._onA11yCharEmitter.event; }
44
+ private _onA11yTabEmitter = new EventEmitter<number>();
45
+ public get onA11yTab(): IEvent<number> { return this._onA11yTabEmitter.event; }
46
+
47
+ /**
48
+ * Creates a new `Terminal` object.
49
+ *
50
+ * @param options An object containing a set of options, the available options are:
51
+ * - `cursorBlink` (boolean): Whether the terminal cursor blinks
52
+ * - `cols` (number): The number of columns of the terminal (horizontal size)
53
+ * - `rows` (number): The number of rows of the terminal (vertical size)
54
+ *
55
+ * @public
56
+ * @class Xterm Xterm
57
+ * @alias module:xterm/src/xterm
58
+ */
59
+ constructor(
60
+ options: ITerminalOptions = {}
61
+ ) {
62
+ super(options);
63
+
64
+ this._setup();
65
+
66
+ // Setup InputHandler listeners
67
+ this.register(this._inputHandler.onRequestBell(() => this.bell()));
68
+ this.register(this._inputHandler.onRequestReset(() => this.reset()));
69
+ this.register(forwardEvent(this._inputHandler.onCursorMove, this._onCursorMove));
70
+ this.register(forwardEvent(this._inputHandler.onTitleChange, this._onTitleChange));
71
+ this.register(forwardEvent(this._inputHandler.onA11yChar, this._onA11yCharEmitter));
72
+ this.register(forwardEvent(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
73
+ }
74
+
75
+ public dispose(): void {
76
+ if (this._isDisposed) {
77
+ return;
78
+ }
79
+ super.dispose();
80
+ this.write = () => { };
81
+ }
82
+
83
+ /**
84
+ * Convenience property to active buffer.
85
+ */
86
+ public get buffer(): IBuffer {
87
+ return this.buffers.active;
88
+ }
89
+
90
+ protected _updateOptions(key: string): void {
91
+ super._updateOptions(key);
92
+
93
+ // TODO: These listeners should be owned by individual components
94
+ switch (key) {
95
+ case 'tabStopWidth': this.buffers.setupTabStops(); break;
96
+ }
97
+ }
98
+
99
+ // TODO: Support paste here?
100
+
101
+ public get markers(): IMarker[] {
102
+ return this.buffer.markers;
103
+ }
104
+
105
+ public addMarker(cursorYOffset: number): IMarker | undefined {
106
+ // Disallow markers on the alt buffer
107
+ if (this.buffer !== this.buffers.normal) {
108
+ return;
109
+ }
110
+
111
+ return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);
112
+ }
113
+
114
+ public bell(): void {
115
+ this._onBell.fire();
116
+ }
117
+
118
+ /**
119
+ * Resizes the terminal.
120
+ *
121
+ * @param x The number of columns to resize to.
122
+ * @param y The number of rows to resize to.
123
+ */
124
+ public resize(x: number, y: number): void {
125
+ if (x === this.cols && y === this.rows) {
126
+ return;
127
+ }
128
+
129
+ super.resize(x, y);
130
+ }
131
+
132
+ /**
133
+ * Clear the entire buffer, making the prompt line the new first line.
134
+ */
135
+ public clear(): void {
136
+ if (this.buffer.ybase === 0 && this.buffer.y === 0) {
137
+ // Don't clear if it's already clear
138
+ return;
139
+ }
140
+ this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);
141
+ this.buffer.lines.length = 1;
142
+ this.buffer.ydisp = 0;
143
+ this.buffer.ybase = 0;
144
+ this.buffer.y = 0;
145
+ for (let i = 1; i < this.rows; i++) {
146
+ this.buffer.lines.push(this.buffer.getBlankLine(DEFAULT_ATTR_DATA));
147
+ }
148
+ this._onScroll.fire({ position: this.buffer.ydisp, source: ScrollSource.TERMINAL });
149
+ }
150
+
151
+ /**
152
+ * Reset terminal.
153
+ * Note: Calling this directly from JS is synchronous but does not clear
154
+ * input buffers and does not reset the parser, thus the terminal will
155
+ * continue to apply pending input data.
156
+ * If you need in band reset (synchronous with input data) consider
157
+ * using DECSTR (soft reset, CSI ! p) or RIS instead (hard reset, ESC c).
158
+ */
159
+ public reset(): void {
160
+ /**
161
+ * Since _setup handles a full terminal creation, we have to carry forward
162
+ * a few things that should not reset.
163
+ */
164
+ this.options.rows = this.rows;
165
+ this.options.cols = this.cols;
166
+
167
+ this._setup();
168
+ super.reset();
169
+ }
170
+ }
@@ -0,0 +1,31 @@
1
+ import { IBuffer, IBufferSet } from 'common/buffer/Types';
2
+ import { IEvent } from 'common/EventEmitter';
3
+ import { IFunctionIdentifier, IParams } from 'common/parser/Types';
4
+ import { ICoreTerminal, IDisposable, IMarker, ITerminalOptions } from 'common/Types';
5
+
6
+ export interface ITerminal extends ICoreTerminal {
7
+ rows: number;
8
+ cols: number;
9
+ buffer: IBuffer;
10
+ buffers: IBufferSet;
11
+ markers: IMarker[];
12
+ // TODO: We should remove options once components adopt optionsService
13
+ options: ITerminalOptions;
14
+
15
+ onCursorMove: IEvent<void>;
16
+ onData: IEvent<string>;
17
+ onBinary: IEvent<string>;
18
+ onLineFeed: IEvent<void>;
19
+ onResize: IEvent<{ cols: number, rows: number }>;
20
+ onTitleChange: IEvent<string>;
21
+ resize(columns: number, rows: number): void;
22
+ addCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean): IDisposable;
23
+ addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean): IDisposable;
24
+ addEscHandler(id: IFunctionIdentifier, callback: () => boolean): IDisposable;
25
+ addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;
26
+ addMarker(cursorYOffset: number): IMarker | undefined;
27
+ dispose(): void;
28
+ clear(): void;
29
+ write(data: string | Uint8Array, callback?: () => void): void;
30
+ reset(): void;
31
+ }