Comparing version 3.13.0-beta3 to 3.13.0-beta4
@@ -44,3 +44,3 @@ "use strict"; | ||
_this._accessibilityTreeRoot.appendChild(_this._rowContainer); | ||
_this._renderRowsDebouncer = new RenderDebouncer_1.RenderDebouncer(_this._terminal, _this._renderRows.bind(_this)); | ||
_this._renderRowsDebouncer = new RenderDebouncer_1.RenderDebouncer(_this._renderRows.bind(_this)); | ||
_this._refreshRows(); | ||
@@ -178,3 +178,3 @@ _this._liveRegion = document.createElement('div'); | ||
AccessibilityManager.prototype._refreshRows = function (start, end) { | ||
this._renderRowsDebouncer.refresh(start, end); | ||
this._renderRowsDebouncer.refresh(start, end, this._terminal.rows); | ||
}; | ||
@@ -181,0 +181,0 @@ AccessibilityManager.prototype._renderRows = function (start, end) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var MouseZoneManager_1 = require("./ui/MouseZoneManager"); | ||
var MouseZoneManager_1 = require("./MouseZoneManager"); | ||
var CharWidth_1 = require("./CharWidth"); | ||
@@ -5,0 +5,0 @@ var EventEmitter2_1 = require("./common/EventEmitter2"); |
@@ -64,3 +64,3 @@ "use strict"; | ||
_this._updateDimensions(); | ||
_this._renderDebouncer = new RenderDebouncer_1.RenderDebouncer(_this._terminal, _this._renderRows.bind(_this)); | ||
_this._renderDebouncer = new RenderDebouncer_1.RenderDebouncer(_this._renderRows.bind(_this)); | ||
_this._rowFactory = new DomRendererRowFactory_1.DomRendererRowFactory(_terminal.options, document); | ||
@@ -280,3 +280,3 @@ _this._terminal.element.classList.add(TERMINAL_CLASS_PREFIX + _this._terminalClass); | ||
DomRenderer.prototype.refreshRows = function (start, end) { | ||
this._renderDebouncer.refresh(start, end); | ||
this._renderDebouncer.refresh(start, end, this._terminal.rows); | ||
}; | ||
@@ -283,0 +283,0 @@ DomRenderer.prototype._renderRows = function (start, end) { |
@@ -64,3 +64,3 @@ "use strict"; | ||
_this.onOptionsChanged(); | ||
_this._renderDebouncer = new RenderDebouncer_1.RenderDebouncer(_this._terminal, _this._renderRows.bind(_this)); | ||
_this._renderDebouncer = new RenderDebouncer_1.RenderDebouncer(_this._renderRows.bind(_this)); | ||
_this._screenDprMonitor = new ScreenDprMonitor_1.ScreenDprMonitor(); | ||
@@ -177,3 +177,3 @@ _this._screenDprMonitor.setListener(function () { return _this.onWindowResize(window.devicePixelRatio); }); | ||
} | ||
this._renderDebouncer.refresh(start, end); | ||
this._renderDebouncer.refresh(start, end, this._terminal.rows); | ||
}; | ||
@@ -180,0 +180,0 @@ Renderer.prototype._renderRows = function (start, end) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var MouseHelper_1 = require("./ui/MouseHelper"); | ||
var MouseHelper_1 = require("./MouseHelper"); | ||
var Browser = require("./common/Platform"); | ||
@@ -5,0 +5,0 @@ var SelectionModel_1 = require("./SelectionModel"); |
@@ -21,3 +21,3 @@ "use strict"; | ||
var Viewport_1 = require("./Viewport"); | ||
var Clipboard_1 = require("./ui/Clipboard"); | ||
var Clipboard_1 = require("./Clipboard"); | ||
var EscapeSequences_1 = require("./common/data/EscapeSequences"); | ||
@@ -28,9 +28,9 @@ var InputHandler_1 = require("./InputHandler"); | ||
var SelectionManager_1 = require("./SelectionManager"); | ||
var CharMeasure_1 = require("./ui/CharMeasure"); | ||
var CharMeasure_1 = require("./CharMeasure"); | ||
var Browser = require("./common/Platform"); | ||
var Lifecycle_1 = require("./ui/Lifecycle"); | ||
var Strings = require("./Strings"); | ||
var MouseHelper_1 = require("./ui/MouseHelper"); | ||
var MouseHelper_1 = require("./MouseHelper"); | ||
var SoundManager_1 = require("./SoundManager"); | ||
var MouseZoneManager_1 = require("./ui/MouseZoneManager"); | ||
var MouseZoneManager_1 = require("./MouseZoneManager"); | ||
var AccessibilityManager_1 = require("./AccessibilityManager"); | ||
@@ -37,0 +37,0 @@ var ScreenDprMonitor_1 = require("./ui/ScreenDprMonitor"); |
@@ -11,4 +11,2 @@ "use strict"; | ||
node.removeEventListener(type, handler, useCapture); | ||
node = null; | ||
handler = null; | ||
} | ||
@@ -15,0 +13,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var RenderDebouncer = (function () { | ||
function RenderDebouncer(_terminal, _callback) { | ||
this._terminal = _terminal; | ||
this._callback = _callback; | ||
this._animationFrame = null; | ||
function RenderDebouncer(_renderCallback) { | ||
this._renderCallback = _renderCallback; | ||
} | ||
@@ -12,13 +10,12 @@ RenderDebouncer.prototype.dispose = function () { | ||
window.cancelAnimationFrame(this._animationFrame); | ||
this._animationFrame = null; | ||
this._animationFrame = undefined; | ||
} | ||
}; | ||
RenderDebouncer.prototype.refresh = function (rowStart, rowEnd) { | ||
RenderDebouncer.prototype.refresh = function (rowStart, rowEnd, rowCount) { | ||
var _this = this; | ||
rowStart = rowStart !== null && rowStart !== undefined ? rowStart : 0; | ||
rowEnd = rowEnd !== null && rowEnd !== undefined ? rowEnd : this._terminal.rows - 1; | ||
var isRowStartSet = this._rowStart !== undefined && this._rowStart !== null; | ||
var isRowEndSet = this._rowEnd !== undefined && this._rowEnd !== null; | ||
this._rowStart = isRowStartSet ? Math.min(this._rowStart, rowStart) : rowStart; | ||
this._rowEnd = isRowEndSet ? Math.max(this._rowEnd, rowEnd) : rowEnd; | ||
this._rowCount = rowCount; | ||
rowStart = rowStart !== undefined ? rowStart : 0; | ||
rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1; | ||
this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart; | ||
this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd; | ||
if (this._animationFrame) { | ||
@@ -30,8 +27,11 @@ return; | ||
RenderDebouncer.prototype._innerRefresh = function () { | ||
if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) { | ||
return; | ||
} | ||
this._rowStart = Math.max(this._rowStart, 0); | ||
this._rowEnd = Math.min(this._rowEnd, this._terminal.rows - 1); | ||
this._callback(this._rowStart, this._rowEnd); | ||
this._rowStart = null; | ||
this._rowEnd = null; | ||
this._animationFrame = null; | ||
this._rowEnd = Math.min(this._rowEnd, this._rowCount - 1); | ||
this._renderCallback(this._rowStart, this._rowEnd); | ||
this._rowStart = undefined; | ||
this._rowEnd = undefined; | ||
this._animationFrame = undefined; | ||
}; | ||
@@ -38,0 +38,0 @@ return RenderDebouncer; |
@@ -20,3 +20,5 @@ "use strict"; | ||
function ScreenDprMonitor() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this._currentDevicePixelRatio = window.devicePixelRatio; | ||
return _this; | ||
} | ||
@@ -30,2 +32,5 @@ ScreenDprMonitor.prototype.setListener = function (listener) { | ||
this._outerListener = function () { | ||
if (!_this._listener) { | ||
return; | ||
} | ||
_this._listener(window.devicePixelRatio, _this._currentDevicePixelRatio); | ||
@@ -41,5 +46,6 @@ _this._updateDpr(); | ||
ScreenDprMonitor.prototype._updateDpr = function () { | ||
if (this._resolutionMediaMatchList) { | ||
this._resolutionMediaMatchList.removeListener(this._outerListener); | ||
if (!this._resolutionMediaMatchList || !this._outerListener) { | ||
return; | ||
} | ||
this._resolutionMediaMatchList.removeListener(this._outerListener); | ||
this._currentDevicePixelRatio = window.devicePixelRatio; | ||
@@ -50,8 +56,9 @@ this._resolutionMediaMatchList = window.matchMedia("screen and (resolution: " + window.devicePixelRatio + "dppx)"); | ||
ScreenDprMonitor.prototype.clearListener = function () { | ||
if (!this._listener) { | ||
if (!this._resolutionMediaMatchList || !this._listener || !this._outerListener) { | ||
return; | ||
} | ||
this._resolutionMediaMatchList.removeListener(this._outerListener); | ||
this._listener = null; | ||
this._outerListener = null; | ||
this._resolutionMediaMatchList = undefined; | ||
this._listener = undefined; | ||
this._outerListener = undefined; | ||
}; | ||
@@ -58,0 +65,0 @@ return ScreenDprMonitor; |
{ | ||
"name": "xterm", | ||
"description": "Full xterm terminal, in your browser", | ||
"version": "3.13.0-beta3", | ||
"version": "3.13.0-beta4", | ||
"main": "lib/public/Terminal.js", | ||
@@ -6,0 +6,0 @@ "types": "typings/xterm.d.ts", |
@@ -64,3 +64,3 @@ /** | ||
this._renderRowsDebouncer = new RenderDebouncer(this._terminal, this._renderRows.bind(this)); | ||
this._renderRowsDebouncer = new RenderDebouncer(this._renderRows.bind(this)); | ||
this._refreshRows(); | ||
@@ -243,3 +243,3 @@ | ||
private _refreshRows(start?: number, end?: number): void { | ||
this._renderRowsDebouncer.refresh(start, end); | ||
this._renderRowsDebouncer.refresh(start, end, this._terminal.rows); | ||
} | ||
@@ -246,0 +246,0 @@ |
@@ -6,5 +6,4 @@ /** | ||
import { IMouseZoneManager } from './ui/Types'; | ||
import { ILinkifierEvent, ILinkMatcher, LinkMatcherHandler, ILinkMatcherOptions, ILinkifier, ITerminal, IBufferStringIteratorResult } from './Types'; | ||
import { MouseZone } from './ui/MouseZoneManager'; | ||
import { ILinkifierEvent, ILinkMatcher, LinkMatcherHandler, ILinkMatcherOptions, ILinkifier, ITerminal, IBufferStringIteratorResult, IMouseZoneManager } from './Types'; | ||
import { MouseZone } from './MouseZoneManager'; | ||
import { getStringCellWidth } from './CharWidth'; | ||
@@ -11,0 +10,0 @@ import { EventEmitter2, IEvent } from './common/EventEmitter2'; |
@@ -83,3 +83,3 @@ /** | ||
this._renderDebouncer = new RenderDebouncer(this._terminal, this._renderRows.bind(this)); | ||
this._renderDebouncer = new RenderDebouncer(this._renderRows.bind(this)); | ||
this._rowFactory = new DomRendererRowFactory(_terminal.options, document); | ||
@@ -344,3 +344,3 @@ | ||
public refreshRows(start: number, end: number): void { | ||
this._renderDebouncer.refresh(start, end); | ||
this._renderDebouncer.refresh(start, end, this._terminal.rows); | ||
} | ||
@@ -347,0 +347,0 @@ |
@@ -71,3 +71,3 @@ /** | ||
this._renderDebouncer = new RenderDebouncer(this._terminal, this._renderRows.bind(this)); | ||
this._renderDebouncer = new RenderDebouncer(this._renderRows.bind(this)); | ||
this._screenDprMonitor = new ScreenDprMonitor(); | ||
@@ -198,3 +198,3 @@ this._screenDprMonitor.setListener(() => this.onWindowResize(window.devicePixelRatio)); | ||
} | ||
this._renderDebouncer.refresh(start, end); | ||
this._renderDebouncer.refresh(start, end, this._terminal.rows); | ||
} | ||
@@ -201,0 +201,0 @@ |
@@ -7,5 +7,5 @@ /** | ||
import { ITerminal, ISelectionManager, IBuffer, IBufferLine, ISelectionRedrawRequestEvent } from './Types'; | ||
import { MouseHelper } from './ui/MouseHelper'; | ||
import { MouseHelper } from './MouseHelper'; | ||
import * as Browser from './common/Platform'; | ||
import { CharMeasure } from './ui/CharMeasure'; | ||
import { CharMeasure } from './CharMeasure'; | ||
import { SelectionModel } from './SelectionModel'; | ||
@@ -12,0 +12,0 @@ import { AltClickHandler } from './handlers/AltClickHandler'; |
@@ -24,4 +24,3 @@ /** | ||
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminalOptions, ITerminal, IBrowser, ILinkifier, ILinkMatcherOptions, CustomKeyEventHandler, LinkMatcherHandler, CharacterJoinerHandler, IBufferLine, IAttributeData } from './Types'; | ||
import { IMouseZoneManager } from './ui/Types'; | ||
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminalOptions, ITerminal, IBrowser, ILinkifier, ILinkMatcherOptions, CustomKeyEventHandler, LinkMatcherHandler, CharacterJoinerHandler, IBufferLine, IAttributeData, IMouseZoneManager } from './Types'; | ||
import { IRenderer } from './renderer/Types'; | ||
@@ -33,3 +32,3 @@ import { BufferSet } from './BufferSet'; | ||
import { Viewport } from './Viewport'; | ||
import { rightClickHandler, moveTextAreaUnderMouseCursor, pasteHandler, copyHandler } from './ui/Clipboard'; | ||
import { rightClickHandler, moveTextAreaUnderMouseCursor, pasteHandler, copyHandler } from './Clipboard'; | ||
import { C0 } from './common/data/EscapeSequences'; | ||
@@ -40,9 +39,9 @@ import { InputHandler } from './InputHandler'; | ||
import { SelectionManager } from './SelectionManager'; | ||
import { CharMeasure } from './ui/CharMeasure'; | ||
import { CharMeasure } from './CharMeasure'; | ||
import * as Browser from './common/Platform'; | ||
import { addDisposableDomListener } from './ui/Lifecycle'; | ||
import * as Strings from './Strings'; | ||
import { MouseHelper } from './ui/MouseHelper'; | ||
import { MouseHelper } from './MouseHelper'; | ||
import { DEFAULT_BELL_SOUND, SoundManager } from './SoundManager'; | ||
import { MouseZoneManager } from './ui/MouseZoneManager'; | ||
import { MouseZoneManager } from './MouseZoneManager'; | ||
import { AccessibilityManager } from './AccessibilityManager'; | ||
@@ -49,0 +48,0 @@ import { ScreenDprMonitor } from './ui/ScreenDprMonitor'; |
@@ -27,4 +27,5 @@ { | ||
{ "path": "./common" }, | ||
{ "path": "./core" } | ||
{ "path": "./core" }, | ||
{ "path": "./ui" } | ||
] | ||
} |
@@ -8,3 +8,2 @@ /** | ||
import { IColorSet, IRenderer } from './renderer/Types'; | ||
import { IMouseZoneManager } from './ui/Types'; | ||
import { ICharset } from './core/Types'; | ||
@@ -608,1 +607,18 @@ import { ICircularList } from './common/Types'; | ||
} | ||
export interface IMouseZoneManager extends IDisposable { | ||
add(zone: IMouseZone): void; | ||
clearAll(start?: number, end?: number): void; | ||
} | ||
export interface IMouseZone { | ||
x1: number; | ||
x2: number; | ||
y1: number; | ||
y2: number; | ||
clickCallback: (e: MouseEvent) => any; | ||
hoverCallback: (e: MouseEvent) => any | undefined; | ||
tooltipCallback: (e: MouseEvent) => any | undefined; | ||
leaveCallback: () => any | undefined; | ||
willLinkActivate: (e: MouseEvent) => boolean; | ||
} |
@@ -6,3 +6,3 @@ /** | ||
import { IDisposable } from 'xterm'; | ||
import { IDisposable } from '../common/Types'; | ||
@@ -28,6 +28,4 @@ /** | ||
node.removeEventListener(type, handler, useCapture); | ||
node = null; | ||
handler = null; | ||
} | ||
}; | ||
} |
@@ -1,4 +0,8 @@ | ||
import { ITerminal } from '../Types'; | ||
import { IDisposable } from 'xterm'; | ||
/** | ||
* Copyright (c) 2018 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
import { IDisposable } from '../common/Types'; | ||
/** | ||
@@ -8,9 +12,9 @@ * Debounces calls to render terminal rows using animation frames. | ||
export class RenderDebouncer implements IDisposable { | ||
private _rowStart: number; | ||
private _rowEnd: number; | ||
private _animationFrame: number = null; | ||
private _rowStart: number | undefined; | ||
private _rowEnd: number | undefined; | ||
private _rowCount: number | undefined; | ||
private _animationFrame: number | undefined; | ||
constructor( | ||
private _terminal: ITerminal, | ||
private _callback: (start: number, end: number) => void | ||
private _renderCallback: (start: number, end: number) => void | ||
) { | ||
@@ -22,16 +26,14 @@ } | ||
window.cancelAnimationFrame(this._animationFrame); | ||
this._animationFrame = null; | ||
this._animationFrame = undefined; | ||
} | ||
} | ||
public refresh(rowStart: number, rowEnd: number): void { | ||
public refresh(rowStart: number, rowEnd: number, rowCount: number): void { | ||
this._rowCount = rowCount; | ||
// Get the min/max row start/end for the arg values | ||
rowStart = rowStart !== null && rowStart !== undefined ? rowStart : 0; | ||
rowEnd = rowEnd !== null && rowEnd !== undefined ? rowEnd : this._terminal.rows - 1; | ||
// Check whether the row start/end values have already been set | ||
const isRowStartSet = this._rowStart !== undefined && this._rowStart !== null; | ||
const isRowEndSet = this._rowEnd !== undefined && this._rowEnd !== null; | ||
rowStart = rowStart !== undefined ? rowStart : 0; | ||
rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1; | ||
// Set the properties to the updated values | ||
this._rowStart = isRowStartSet ? Math.min(this._rowStart, rowStart) : rowStart; | ||
this._rowEnd = isRowEndSet ? Math.max(this._rowEnd, rowEnd) : rowEnd; | ||
this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart; | ||
this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd; | ||
@@ -46,14 +48,19 @@ if (this._animationFrame) { | ||
private _innerRefresh(): void { | ||
// Make sure values are set | ||
if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) { | ||
return; | ||
} | ||
// Clamp values | ||
this._rowStart = Math.max(this._rowStart, 0); | ||
this._rowEnd = Math.min(this._rowEnd, this._terminal.rows - 1); | ||
this._rowEnd = Math.min(this._rowEnd, this._rowCount - 1); | ||
// Run render callback | ||
this._callback(this._rowStart, this._rowEnd); | ||
this._renderCallback(this._rowStart, this._rowEnd); | ||
// Reset debouncer | ||
this._rowStart = null; | ||
this._rowEnd = null; | ||
this._animationFrame = null; | ||
this._rowStart = undefined; | ||
this._rowEnd = undefined; | ||
this._animationFrame = undefined; | ||
} | ||
} |
@@ -21,6 +21,6 @@ /** | ||
export class ScreenDprMonitor extends Disposable { | ||
private _currentDevicePixelRatio: number; | ||
private _outerListener: (this: MediaQueryList, ev: MediaQueryListEvent) => any; | ||
private _listener: ScreenDprListener; | ||
private _resolutionMediaMatchList: MediaQueryList; | ||
private _currentDevicePixelRatio: number = window.devicePixelRatio; | ||
private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined; | ||
private _listener: ScreenDprListener | undefined; | ||
private _resolutionMediaMatchList: MediaQueryList | undefined; | ||
@@ -33,2 +33,5 @@ public setListener(listener: ScreenDprListener): void { | ||
this._outerListener = () => { | ||
if (!this._listener) { | ||
return; | ||
} | ||
this._listener(window.devicePixelRatio, this._currentDevicePixelRatio); | ||
@@ -46,6 +49,9 @@ this._updateDpr(); | ||
private _updateDpr(): void { | ||
if (!this._resolutionMediaMatchList || !this._outerListener) { | ||
return; | ||
} | ||
// Clear listeners for old DPR | ||
if (this._resolutionMediaMatchList) { | ||
this._resolutionMediaMatchList.removeListener(this._outerListener); | ||
} | ||
this._resolutionMediaMatchList.removeListener(this._outerListener); | ||
// Add listeners for new DPR | ||
@@ -58,9 +64,10 @@ this._currentDevicePixelRatio = window.devicePixelRatio; | ||
public clearListener(): void { | ||
if (!this._listener) { | ||
if (!this._resolutionMediaMatchList || !this._listener || !this._outerListener) { | ||
return; | ||
} | ||
this._resolutionMediaMatchList.removeListener(this._outerListener); | ||
this._listener = null; | ||
this._outerListener = null; | ||
this._resolutionMediaMatchList = undefined; | ||
this._listener = undefined; | ||
this._outerListener = undefined; | ||
} | ||
} |
@@ -8,3 +8,3 @@ /** | ||
import { ITerminal, IViewport } from './Types'; | ||
import { CharMeasure } from './ui/CharMeasure'; | ||
import { CharMeasure } from './CharMeasure'; | ||
import { Disposable } from './common/Lifecycle'; | ||
@@ -11,0 +11,0 @@ import { addDisposableDomListener } from './ui/Lifecycle'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2557917
299
38598