From 913faef3b84b0d2abccf5afa2de9aa6a0fe5566f Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 14 Jun 2019 21:38:19 -0700 Subject: [PATCH] Split src/ Types.ts into d.ts and Constants --- src/{Types.ts => Types.d.ts} | 6 +++--- src/renderer/BaseRenderLayer.ts | 3 ++- src/renderer/Constants.ts | 17 +++++++++++++++++ src/renderer/LinkRenderLayer.ts | 2 +- src/renderer/{Types.ts => Types.d.ts} | 13 ------------- src/renderer/atlas/Constants.ts | 9 +++++++++ src/renderer/atlas/DynamicCharAtlas.ts | 3 ++- src/renderer/atlas/{Types.ts => Types.d.ts} | 5 ----- src/renderer/dom/DomRenderer.ts | 2 +- src/renderer/dom/DomRendererRowFactory.ts | 2 +- 10 files changed, 36 insertions(+), 26 deletions(-) rename src/{Types.ts => Types.d.ts} (98%) create mode 100644 src/renderer/Constants.ts rename src/renderer/{Types.ts => Types.d.ts} (91%) create mode 100644 src/renderer/atlas/Constants.ts rename src/renderer/atlas/{Types.ts => Types.d.ts} (83%) diff --git a/src/Types.ts b/src/Types.d.ts similarity index 98% rename from src/Types.ts rename to src/Types.d.ts index 721ab063..6f587931 100644 --- a/src/Types.ts +++ b/src/Types.d.ts @@ -5,7 +5,7 @@ import { ITerminalOptions as IPublicTerminalOptions, IDisposable, IMarker, ISelectionPosition } from 'xterm'; import { ICharset, IAttributeData, CharData } from 'common/Types'; -import { IEvent, EventEmitter } from 'common/EventEmitter'; +import { IEvent, IEventEmitter } from 'common/EventEmitter'; import { IColorSet, IMouseHelper } from 'browser/Types'; import { IOptionsService } from 'common/services/Services'; import { IBuffer, IBufferSet } from 'common/buffer/Types'; @@ -54,8 +54,8 @@ export interface IInputHandlingTerminal { viewport: IViewport; selectionManager: ISelectionManager; - onA11yCharEmitter: EventEmitter; - onA11yTabEmitter: EventEmitter; + onA11yCharEmitter: IEventEmitter; + onA11yTabEmitter: IEventEmitter; bell(): void; focus(): void; diff --git a/src/renderer/BaseRenderLayer.ts b/src/renderer/BaseRenderLayer.ts index f4ff6ccb..89679d3c 100644 --- a/src/renderer/BaseRenderLayer.ts +++ b/src/renderer/BaseRenderLayer.ts @@ -8,7 +8,8 @@ import { IRenderDimensions } from 'browser/renderer/Types'; import { ITerminal } from '../Types'; import { ICellData } from 'common/Types'; import { DEFAULT_COLOR } from 'common/buffer/Constants'; -import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier } from './atlas/Types'; +import { IGlyphIdentifier } from './atlas/Types'; +import { DIM_OPACITY, INVERTED_DEFAULT_COLOR } from './atlas/Constants'; import { BaseCharAtlas } from './atlas/BaseCharAtlas'; import { acquireCharAtlas } from './atlas/CharAtlasCache'; import { CellData, AttributeData, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE } from 'common/buffer/BufferLine'; diff --git a/src/renderer/Constants.ts b/src/renderer/Constants.ts new file mode 100644 index 00000000..36ce9b07 --- /dev/null +++ b/src/renderer/Constants.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2017 The xterm.js authors. All rights reserved. + * @license MIT + */ + +/** + * Flags used to render terminal text properly for the old CharData format + */ +export const enum FLAGS { + BOLD = 1, + UNDERLINE = 2, + BLINK = 4, + INVERSE = 8, + INVISIBLE = 16, + DIM = 32, + ITALIC = 64 +} diff --git a/src/renderer/LinkRenderLayer.ts b/src/renderer/LinkRenderLayer.ts index 32db3db9..99eff4a2 100644 --- a/src/renderer/LinkRenderLayer.ts +++ b/src/renderer/LinkRenderLayer.ts @@ -6,7 +6,7 @@ import { ILinkifierEvent, ITerminal, ILinkifierAccessor } from '../Types'; import { IRenderDimensions } from 'browser/renderer/Types'; import { BaseRenderLayer } from './BaseRenderLayer'; -import { INVERTED_DEFAULT_COLOR } from './atlas/Types'; +import { INVERTED_DEFAULT_COLOR } from './atlas/Constants'; import { is256Color } from './atlas/CharAtlasUtils'; import { IColorSet } from 'browser/Types'; diff --git a/src/renderer/Types.ts b/src/renderer/Types.d.ts similarity index 91% rename from src/renderer/Types.ts rename to src/renderer/Types.d.ts index 153b68e2..5f7d67a8 100644 --- a/src/renderer/Types.ts +++ b/src/renderer/Types.d.ts @@ -8,19 +8,6 @@ import { IDisposable } from 'xterm'; import { IColorSet } from 'browser/Types'; import { IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types'; -/** - * Flags used to render terminal text properly. - */ -export const enum FLAGS { - BOLD = 1, - UNDERLINE = 2, - BLINK = 4, - INVERSE = 8, - INVISIBLE = 16, - DIM = 32, - ITALIC = 64 -} - export interface IRenderLayer extends IDisposable { /** * Called when the terminal loses focus. diff --git a/src/renderer/atlas/Constants.ts b/src/renderer/atlas/Constants.ts new file mode 100644 index 00000000..150aad88 --- /dev/null +++ b/src/renderer/atlas/Constants.ts @@ -0,0 +1,9 @@ +/** + * Copyright (c) 2017 The xterm.js authors. All rights reserved. + * @license MIT + */ + +export const INVERTED_DEFAULT_COLOR = 257; +export const DIM_OPACITY = 0.5; + +export const CHAR_ATLAS_CELL_SPACING = 1; diff --git a/src/renderer/atlas/DynamicCharAtlas.ts b/src/renderer/atlas/DynamicCharAtlas.ts index c8ccefcb..fdae4e80 100644 --- a/src/renderer/atlas/DynamicCharAtlas.ts +++ b/src/renderer/atlas/DynamicCharAtlas.ts @@ -3,7 +3,8 @@ * @license MIT */ -import { DIM_OPACITY, IGlyphIdentifier, INVERTED_DEFAULT_COLOR, ICharAtlasConfig } from './Types'; +import { IGlyphIdentifier, ICharAtlasConfig } from './Types'; +import { DIM_OPACITY, INVERTED_DEFAULT_COLOR } from './Constants'; import { BaseCharAtlas } from './BaseCharAtlas'; import { DEFAULT_ANSI_COLORS } from 'browser/ColorManager'; import { LRUMap } from './LRUMap'; diff --git a/src/renderer/atlas/Types.ts b/src/renderer/atlas/Types.d.ts similarity index 83% rename from src/renderer/atlas/Types.ts rename to src/renderer/atlas/Types.d.ts index 2cb1db40..1de843e0 100644 --- a/src/renderer/atlas/Types.ts +++ b/src/renderer/atlas/Types.d.ts @@ -6,11 +6,6 @@ import { FontWeight } from 'xterm'; import { IColorSet } from 'browser/Types'; -export const INVERTED_DEFAULT_COLOR = 257; -export const DIM_OPACITY = 0.5; - -export const CHAR_ATLAS_CELL_SPACING = 1; - export interface IGlyphIdentifier { chars: string; code: number; diff --git a/src/renderer/dom/DomRenderer.ts b/src/renderer/dom/DomRenderer.ts index 284905c6..fe6ab4d1 100644 --- a/src/renderer/dom/DomRenderer.ts +++ b/src/renderer/dom/DomRenderer.ts @@ -6,7 +6,7 @@ import { IRenderer, IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types'; import { ILinkifierEvent, ITerminal } from '../../Types'; import { BOLD_CLASS, ITALIC_CLASS, CURSOR_CLASS, CURSOR_STYLE_BLOCK_CLASS, CURSOR_BLINK_CLASS, CURSOR_STYLE_BAR_CLASS, CURSOR_STYLE_UNDERLINE_CLASS, DomRendererRowFactory } from './DomRendererRowFactory'; -import { INVERTED_DEFAULT_COLOR } from '../atlas/Types'; +import { INVERTED_DEFAULT_COLOR } from '../atlas/Constants'; import { Disposable } from 'common/Lifecycle'; import { IColorSet } from 'browser/Types'; import { ICharSizeService } from 'browser/services/Services'; diff --git a/src/renderer/dom/DomRendererRowFactory.ts b/src/renderer/dom/DomRendererRowFactory.ts index 8c31aa44..b4de161f 100644 --- a/src/renderer/dom/DomRendererRowFactory.ts +++ b/src/renderer/dom/DomRendererRowFactory.ts @@ -5,7 +5,7 @@ import { ITerminalOptions } from '../../Types'; import { IBufferLine } from 'common/Types'; -import { INVERTED_DEFAULT_COLOR } from '../atlas/Types'; +import { INVERTED_DEFAULT_COLOR } from '../atlas/Constants'; import { CellData, AttributeData, NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from 'common/buffer/BufferLine'; export const BOLD_CLASS = 'xterm-bold';