custom-electron-titlebar 4.2.0 → 4.2.1
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/base/browser/browser.d.ts +26 -0
- package/dist/base/browser/browser.js +317 -0
- package/dist/base/browser/event.d.ts +12 -0
- package/dist/base/browser/event.js +215 -0
- package/dist/base/browser/keyboardEvent.d.ts +38 -0
- package/dist/base/browser/keyboardEvent.js +466 -0
- package/dist/base/browser/mouseEvent.d.ts +61 -0
- package/dist/base/browser/mouseEvent.js +327 -0
- package/dist/base/browser/touch.d.ts +39 -0
- package/dist/base/browser/touch.js +454 -0
- package/dist/base/common/arrays.d.ts +10 -0
- package/dist/base/common/arrays.js +210 -0
- package/dist/base/common/async.d.ts +35 -0
- package/dist/base/common/async.js +280 -0
- package/dist/base/common/charCode.d.ts +405 -0
- package/dist/base/common/charCode.js +9 -0
- package/dist/base/common/color.d.ts +159 -0
- package/dist/base/common/color.js +709 -0
- package/dist/base/common/decorators.d.ts +6 -0
- package/dist/base/common/decorators.js +300 -0
- package/dist/base/common/dom.d.ts +221 -0
- package/dist/base/common/dom.js +1478 -0
- package/dist/base/common/event.d.ts +213 -0
- package/dist/base/common/event.js +804 -0
- package/dist/base/common/iterator.d.ts +69 -0
- package/dist/base/common/iterator.js +381 -0
- package/dist/base/common/keyCodes.d.ts +478 -0
- package/dist/base/common/keyCodes.js +479 -0
- package/dist/base/common/lifecycle.d.ts +17 -0
- package/dist/base/common/lifecycle.js +258 -0
- package/dist/base/common/linkedList.d.ts +17 -0
- package/dist/base/common/linkedList.js +319 -0
- package/dist/base/common/platform.d.ts +33 -0
- package/dist/base/common/platform.js +302 -0
- package/dist/base/common/strings.d.ts +23 -0
- package/dist/base/common/strings.js +273 -0
- package/dist/consts.d.ts +49 -0
- package/dist/consts.js +303 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +211 -0
- package/dist/main/attach-titlebar-to-window.d.ts +3 -0
- package/dist/main/attach-titlebar-to-window.js +207 -0
- package/dist/main/index.d.ts +3 -0
- package/dist/main/index.js +202 -0
- package/dist/main/setup-titlebar.d.ts +2 -0
- package/dist/main/setup-titlebar.js +242 -0
- package/dist/menubar/index.d.ts +86 -0
- package/dist/menubar/index.js +1118 -0
- package/dist/menubar/menu/index.d.ts +46 -0
- package/dist/menubar/menu/index.js +556 -0
- package/dist/menubar/menu/item.d.ts +67 -0
- package/dist/menubar/menu/item.js +575 -0
- package/dist/menubar/menu/separator.d.ts +11 -0
- package/dist/menubar/menu/separator.js +213 -0
- package/dist/menubar/menu/submenu.d.ts +32 -0
- package/dist/menubar/menu/submenu.js +372 -0
- package/dist/menubar/menubar-options.d.ts +55 -0
- package/dist/menubar/menubar-options.js +9 -0
- package/dist/titlebar/index.d.ts +99 -0
- package/dist/titlebar/index.js +663 -0
- package/dist/titlebar/options.d.ts +84 -0
- package/dist/titlebar/options.js +9 -0
- package/dist/titlebar/themebar.d.ts +20 -0
- package/dist/titlebar/themebar.js +267 -0
- package/package.json +1 -1
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*---------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
+
*--------------------------------------------------------------------------------------------*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.throttle = exports.debounce = exports.memoize = void 0;
|
|
11
|
+
function createDecorator(mapFn) {
|
|
12
|
+
return (target, key, descriptor) => {
|
|
13
|
+
let fnKey = null;
|
|
14
|
+
let fn = null;
|
|
15
|
+
if (typeof descriptor.value === 'function') {
|
|
16
|
+
fnKey = 'value';
|
|
17
|
+
fn = descriptor.value;
|
|
18
|
+
} else if (typeof descriptor.get === 'function') {
|
|
19
|
+
fnKey = 'get';
|
|
20
|
+
fn = descriptor.get;
|
|
21
|
+
}
|
|
22
|
+
if (!fn) {
|
|
23
|
+
throw new Error('not supported');
|
|
24
|
+
}
|
|
25
|
+
descriptor[fnKey] = mapFn(fn, key);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function memoize(_target, key, descriptor) {
|
|
29
|
+
let fnKey = null;
|
|
30
|
+
let fn = null;
|
|
31
|
+
if (typeof descriptor.value === 'function') {
|
|
32
|
+
fnKey = 'value';
|
|
33
|
+
fn = descriptor.value;
|
|
34
|
+
if (fn.length !== 0) {
|
|
35
|
+
console.warn('Memoize should only be used in functions with zero parameters');
|
|
36
|
+
}
|
|
37
|
+
} else if (typeof descriptor.get === 'function') {
|
|
38
|
+
fnKey = 'get';
|
|
39
|
+
fn = descriptor.get;
|
|
40
|
+
}
|
|
41
|
+
if (!fn) {
|
|
42
|
+
throw new Error('not supported');
|
|
43
|
+
}
|
|
44
|
+
const memoizeKey = `$memoize$${key}`;
|
|
45
|
+
descriptor[fnKey] = function (...args) {
|
|
46
|
+
if (!this.hasOwnProperty(memoizeKey)) {
|
|
47
|
+
Object.defineProperty(this, memoizeKey, {
|
|
48
|
+
configurable: false,
|
|
49
|
+
enumerable: false,
|
|
50
|
+
writable: false,
|
|
51
|
+
value: fn.apply(this, args)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return this[memoizeKey];
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.memoize = _get__("memoize");
|
|
58
|
+
function debounce(delay, reducer, initialValueProvider) {
|
|
59
|
+
return _get__("createDecorator")((fn, key) => {
|
|
60
|
+
const timerKey = `$debounce$${key}`;
|
|
61
|
+
const resultKey = `$debounce$result$${key}`;
|
|
62
|
+
return function (...args) {
|
|
63
|
+
if (!this[resultKey]) {
|
|
64
|
+
this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;
|
|
65
|
+
}
|
|
66
|
+
clearTimeout(this[timerKey]);
|
|
67
|
+
if (reducer) {
|
|
68
|
+
this[resultKey] = reducer(this[resultKey], ...args);
|
|
69
|
+
args = [this[resultKey]];
|
|
70
|
+
}
|
|
71
|
+
this[timerKey] = setTimeout(() => {
|
|
72
|
+
fn.apply(this, args);
|
|
73
|
+
this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;
|
|
74
|
+
}, delay);
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
exports.debounce = _get__("debounce");
|
|
79
|
+
function throttle(delay, reducer, initialValueProvider) {
|
|
80
|
+
return _get__("createDecorator")((fn, key) => {
|
|
81
|
+
const timerKey = `$throttle$timer$${key}`;
|
|
82
|
+
const resultKey = `$throttle$result$${key}`;
|
|
83
|
+
const lastRunKey = `$throttle$lastRun$${key}`;
|
|
84
|
+
const pendingKey = `$throttle$pending$${key}`;
|
|
85
|
+
return function (...args) {
|
|
86
|
+
if (!this[resultKey]) {
|
|
87
|
+
this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;
|
|
88
|
+
}
|
|
89
|
+
if (this[lastRunKey] === null || this[lastRunKey] === undefined) {
|
|
90
|
+
this[lastRunKey] = -Number.MAX_VALUE;
|
|
91
|
+
}
|
|
92
|
+
if (reducer) {
|
|
93
|
+
this[resultKey] = reducer(this[resultKey], ...args);
|
|
94
|
+
}
|
|
95
|
+
if (this[pendingKey]) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const nextTime = this[lastRunKey] + delay;
|
|
99
|
+
if (nextTime <= Date.now()) {
|
|
100
|
+
this[lastRunKey] = Date.now();
|
|
101
|
+
fn.apply(this, [this[resultKey]]);
|
|
102
|
+
this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;
|
|
103
|
+
} else {
|
|
104
|
+
this[pendingKey] = true;
|
|
105
|
+
this[timerKey] = setTimeout(() => {
|
|
106
|
+
this[pendingKey] = false;
|
|
107
|
+
this[lastRunKey] = Date.now();
|
|
108
|
+
fn.apply(this, [this[resultKey]]);
|
|
109
|
+
this[resultKey] = initialValueProvider ? initialValueProvider() : undefined;
|
|
110
|
+
}, nextTime - Date.now());
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
exports.throttle = _get__("throttle");
|
|
116
|
+
function _getGlobalObject() {
|
|
117
|
+
try {
|
|
118
|
+
if (!!global) {
|
|
119
|
+
return global;
|
|
120
|
+
}
|
|
121
|
+
} catch (e) {
|
|
122
|
+
try {
|
|
123
|
+
if (!!window) {
|
|
124
|
+
return window;
|
|
125
|
+
}
|
|
126
|
+
} catch (e) {
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
;
|
|
132
|
+
var _RewireModuleId__ = null;
|
|
133
|
+
function _getRewireModuleId__() {
|
|
134
|
+
if (_RewireModuleId__ === null) {
|
|
135
|
+
let globalVariable = _getGlobalObject();
|
|
136
|
+
if (!globalVariable.__$$GLOBAL_REWIRE_NEXT_MODULE_ID__) {
|
|
137
|
+
globalVariable.__$$GLOBAL_REWIRE_NEXT_MODULE_ID__ = 0;
|
|
138
|
+
}
|
|
139
|
+
_RewireModuleId__ = __$$GLOBAL_REWIRE_NEXT_MODULE_ID__++;
|
|
140
|
+
}
|
|
141
|
+
return _RewireModuleId__;
|
|
142
|
+
}
|
|
143
|
+
function _getRewireRegistry__() {
|
|
144
|
+
let theGlobalVariable = _getGlobalObject();
|
|
145
|
+
if (!theGlobalVariable.__$$GLOBAL_REWIRE_REGISTRY__) {
|
|
146
|
+
theGlobalVariable.__$$GLOBAL_REWIRE_REGISTRY__ = Object.create(null);
|
|
147
|
+
}
|
|
148
|
+
return theGlobalVariable.__$$GLOBAL_REWIRE_REGISTRY__;
|
|
149
|
+
}
|
|
150
|
+
function _getRewiredData__() {
|
|
151
|
+
let moduleId = _getRewireModuleId__();
|
|
152
|
+
let registry = _getRewireRegistry__();
|
|
153
|
+
let rewireData = registry[moduleId];
|
|
154
|
+
if (!rewireData) {
|
|
155
|
+
registry[moduleId] = Object.create(null);
|
|
156
|
+
rewireData = registry[moduleId];
|
|
157
|
+
}
|
|
158
|
+
return rewireData;
|
|
159
|
+
}
|
|
160
|
+
(function registerResetAll() {
|
|
161
|
+
let theGlobalVariable = _getGlobalObject();
|
|
162
|
+
if (!theGlobalVariable['__rewire_reset_all__']) {
|
|
163
|
+
theGlobalVariable['__rewire_reset_all__'] = function () {
|
|
164
|
+
theGlobalVariable.__$$GLOBAL_REWIRE_REGISTRY__ = Object.create(null);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
})();
|
|
168
|
+
var INTENTIONAL_UNDEFINED = '__INTENTIONAL_UNDEFINED__';
|
|
169
|
+
let _RewireAPI__ = {};
|
|
170
|
+
(function () {
|
|
171
|
+
function addPropertyToAPIObject(name, value) {
|
|
172
|
+
Object.defineProperty(_RewireAPI__, name, {
|
|
173
|
+
value: value,
|
|
174
|
+
enumerable: false,
|
|
175
|
+
configurable: true
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
addPropertyToAPIObject('__get__', _get__);
|
|
179
|
+
addPropertyToAPIObject('__GetDependency__', _get__);
|
|
180
|
+
addPropertyToAPIObject('__Rewire__', _set__);
|
|
181
|
+
addPropertyToAPIObject('__set__', _set__);
|
|
182
|
+
addPropertyToAPIObject('__reset__', _reset__);
|
|
183
|
+
addPropertyToAPIObject('__ResetDependency__', _reset__);
|
|
184
|
+
addPropertyToAPIObject('__with__', _with__);
|
|
185
|
+
})();
|
|
186
|
+
function _get__(variableName) {
|
|
187
|
+
let rewireData = _getRewiredData__();
|
|
188
|
+
if (rewireData[variableName] === undefined) {
|
|
189
|
+
return _get_original__(variableName);
|
|
190
|
+
} else {
|
|
191
|
+
var value = rewireData[variableName];
|
|
192
|
+
if (value === INTENTIONAL_UNDEFINED) {
|
|
193
|
+
return undefined;
|
|
194
|
+
} else {
|
|
195
|
+
return value;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function _get_original__(variableName) {
|
|
200
|
+
switch (variableName) {
|
|
201
|
+
case "memoize":
|
|
202
|
+
return memoize;
|
|
203
|
+
case "createDecorator":
|
|
204
|
+
return createDecorator;
|
|
205
|
+
case "debounce":
|
|
206
|
+
return debounce;
|
|
207
|
+
case "throttle":
|
|
208
|
+
return throttle;
|
|
209
|
+
}
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
function _assign__(variableName, value) {
|
|
213
|
+
let rewireData = _getRewiredData__();
|
|
214
|
+
if (rewireData[variableName] === undefined) {
|
|
215
|
+
return _set_original__(variableName, value);
|
|
216
|
+
} else {
|
|
217
|
+
return rewireData[variableName] = value;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function _set_original__(variableName, _value) {
|
|
221
|
+
switch (variableName) {}
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
function _update_operation__(operation, variableName, prefix) {
|
|
225
|
+
var oldValue = _get__(variableName);
|
|
226
|
+
var newValue = operation === '++' ? oldValue + 1 : oldValue - 1;
|
|
227
|
+
_assign__(variableName, newValue);
|
|
228
|
+
return prefix ? newValue : oldValue;
|
|
229
|
+
}
|
|
230
|
+
function _set__(variableName, value) {
|
|
231
|
+
let rewireData = _getRewiredData__();
|
|
232
|
+
if (typeof variableName === 'object') {
|
|
233
|
+
Object.keys(variableName).forEach(function (name) {
|
|
234
|
+
rewireData[name] = variableName[name];
|
|
235
|
+
});
|
|
236
|
+
return function () {
|
|
237
|
+
Object.keys(variableName).forEach(function (name) {
|
|
238
|
+
_reset__(variableName);
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
} else {
|
|
242
|
+
if (value === undefined) {
|
|
243
|
+
rewireData[variableName] = INTENTIONAL_UNDEFINED;
|
|
244
|
+
} else {
|
|
245
|
+
rewireData[variableName] = value;
|
|
246
|
+
}
|
|
247
|
+
return function () {
|
|
248
|
+
_reset__(variableName);
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function _reset__(variableName) {
|
|
253
|
+
let rewireData = _getRewiredData__();
|
|
254
|
+
delete rewireData[variableName];
|
|
255
|
+
if (Object.keys(rewireData).length == 0) {
|
|
256
|
+
delete _getRewireRegistry__()[_getRewireModuleId__];
|
|
257
|
+
}
|
|
258
|
+
;
|
|
259
|
+
}
|
|
260
|
+
function _with__(object) {
|
|
261
|
+
let rewireData = _getRewiredData__();
|
|
262
|
+
var rewiredVariableNames = Object.keys(object);
|
|
263
|
+
var previousValues = {};
|
|
264
|
+
function reset() {
|
|
265
|
+
rewiredVariableNames.forEach(function (variableName) {
|
|
266
|
+
rewireData[variableName] = previousValues[variableName];
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
return function (callback) {
|
|
270
|
+
rewiredVariableNames.forEach(function (variableName) {
|
|
271
|
+
previousValues[variableName] = rewireData[variableName];
|
|
272
|
+
rewireData[variableName] = object[variableName];
|
|
273
|
+
});
|
|
274
|
+
let result = callback();
|
|
275
|
+
if (!!result && typeof result.then == 'function') {
|
|
276
|
+
result.then(reset).catch(reset);
|
|
277
|
+
} else {
|
|
278
|
+
reset();
|
|
279
|
+
}
|
|
280
|
+
return result;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
let _typeOfOriginalExport = typeof module.exports;
|
|
284
|
+
function addNonEnumerableProperty(name, value) {
|
|
285
|
+
Object.defineProperty(module.exports, name, {
|
|
286
|
+
value: value,
|
|
287
|
+
enumerable: false,
|
|
288
|
+
configurable: true
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
if ((_typeOfOriginalExport === 'object' || _typeOfOriginalExport === 'function') && Object.isExtensible(module.exports)) {
|
|
292
|
+
addNonEnumerableProperty('__get__', _get__);
|
|
293
|
+
addNonEnumerableProperty('__GetDependency__', _get__);
|
|
294
|
+
addNonEnumerableProperty('__Rewire__', _set__);
|
|
295
|
+
addNonEnumerableProperty('__set__', _set__);
|
|
296
|
+
addNonEnumerableProperty('__reset__', _reset__);
|
|
297
|
+
addNonEnumerableProperty('__ResetDependency__', _reset__);
|
|
298
|
+
addNonEnumerableProperty('__with__', _with__);
|
|
299
|
+
addNonEnumerableProperty('__RewireAPI__', _RewireAPI__);
|
|
300
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { IKeyboardEvent } from '../browser/keyboardEvent';
|
|
2
|
+
import { IMouseEvent } from '../browser/mouseEvent';
|
|
3
|
+
import { Emitter, Event } from '../common/event';
|
|
4
|
+
import { IDisposable } from '../common/lifecycle';
|
|
5
|
+
export declare function clearNode(node: HTMLElement): void;
|
|
6
|
+
export declare function removeNode(node: HTMLElement): void;
|
|
7
|
+
export declare function isInDOM(node: Node | null): boolean;
|
|
8
|
+
type ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';
|
|
9
|
+
export interface IModifierKeyStatus {
|
|
10
|
+
altKey: boolean;
|
|
11
|
+
shiftKey: boolean;
|
|
12
|
+
ctrlKey: boolean;
|
|
13
|
+
metaKey: boolean;
|
|
14
|
+
lastKeyPressed?: ModifierKey;
|
|
15
|
+
lastKeyReleased?: ModifierKey;
|
|
16
|
+
event?: KeyboardEvent;
|
|
17
|
+
}
|
|
18
|
+
export declare class ModifierKeyEmitter extends Emitter<IModifierKeyStatus> {
|
|
19
|
+
private _keyStatus;
|
|
20
|
+
private static instance;
|
|
21
|
+
private constructor();
|
|
22
|
+
get keyStatus(): IModifierKeyStatus;
|
|
23
|
+
get isModifierPressed(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Allows to explicitly reset the key status based on more knowledge (#109062)
|
|
26
|
+
*/
|
|
27
|
+
resetKeyStatus(): void;
|
|
28
|
+
private doResetKeyStatus;
|
|
29
|
+
static getInstance(): ModifierKeyEmitter;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
32
|
+
export declare const hasClass: (node: HTMLElement, className: string) => boolean;
|
|
33
|
+
export declare const addClass: (node: HTMLElement, className: string) => void;
|
|
34
|
+
export declare const addClasses: (node: HTMLElement, ...classNames: string[]) => void;
|
|
35
|
+
export declare const removeClass: (node: HTMLElement, className: string) => void;
|
|
36
|
+
export declare const removeClasses: (node: HTMLElement, ...classNames: string[]) => void;
|
|
37
|
+
export declare const toggleClass: (node: HTMLElement, className: string, shouldHaveIt?: boolean) => void;
|
|
38
|
+
export declare function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;
|
|
39
|
+
export declare function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
|
|
40
|
+
export declare function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;
|
|
41
|
+
export interface IAddStandardDisposableListenerSignature {
|
|
42
|
+
(node: HTMLElement, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;
|
|
43
|
+
(node: HTMLElement, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;
|
|
44
|
+
(node: HTMLElement, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;
|
|
45
|
+
(node: HTMLElement, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;
|
|
46
|
+
(node: HTMLElement, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;
|
|
47
|
+
(node: HTMLElement, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
|
|
48
|
+
}
|
|
49
|
+
export declare const addStandardDisposableListener: IAddStandardDisposableListenerSignature;
|
|
50
|
+
export declare function addDisposableNonBubblingMouseOutListener(node: Element, handler: (event: MouseEvent) => void): IDisposable;
|
|
51
|
+
/**
|
|
52
|
+
* Schedule a callback to be run at the next animation frame.
|
|
53
|
+
* This allows multiple parties to register callbacks that should run at the next animation frame.
|
|
54
|
+
* If currently in an animation frame, `runner` will be executed immediately.
|
|
55
|
+
* @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).
|
|
56
|
+
*/
|
|
57
|
+
export declare let runAtThisOrScheduleAtNextAnimationFrame: (runner: () => void, priority?: number) => IDisposable;
|
|
58
|
+
/**
|
|
59
|
+
* Schedule a callback to be run at the next animation frame.
|
|
60
|
+
* This allows multiple parties to register callbacks that should run at the next animation frame.
|
|
61
|
+
* If currently in an animation frame, `runner` will be executed at the next animation frame.
|
|
62
|
+
* @return token that can be used to cancel the scheduled runner.
|
|
63
|
+
*/
|
|
64
|
+
export declare let scheduleAtNextAnimationFrame: (runner: () => void, priority?: number) => IDisposable;
|
|
65
|
+
export declare function measure(callback: () => void): IDisposable;
|
|
66
|
+
export declare function modify(callback: () => void): IDisposable;
|
|
67
|
+
/**
|
|
68
|
+
* Add a throttled listener. `handler` is fired at most every 16ms or with the next animation frame (if browser supports it).
|
|
69
|
+
*/
|
|
70
|
+
export interface IEventMerger<R, E> {
|
|
71
|
+
(lastEvent: R | null, currentEvent: E): R;
|
|
72
|
+
}
|
|
73
|
+
export interface DOMEvent {
|
|
74
|
+
preventDefault(): void;
|
|
75
|
+
stopPropagation(): void;
|
|
76
|
+
}
|
|
77
|
+
export declare function addDisposableThrottledListener<R, E extends DOMEvent = DOMEvent>(node: any, type: string, handler: (event: R) => void, eventMerger?: IEventMerger<R, E>, minimumTimeMs?: number): IDisposable;
|
|
78
|
+
export declare function getComputedStyle(el: HTMLElement): CSSStyleDeclaration;
|
|
79
|
+
export declare function getClientArea(element: HTMLElement): Dimension;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the effective zoom on a given element before window zoom level is applied
|
|
82
|
+
*/
|
|
83
|
+
export declare function getDomNodeZoomLevel(domNode: HTMLElement): number;
|
|
84
|
+
export declare class Dimension {
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
constructor(width: number, height: number);
|
|
88
|
+
static equals(a: Dimension | undefined, b: Dimension | undefined): boolean;
|
|
89
|
+
}
|
|
90
|
+
export declare function getTopLeftOffset(element: HTMLElement): {
|
|
91
|
+
left: number;
|
|
92
|
+
top: number;
|
|
93
|
+
};
|
|
94
|
+
export interface IDomNodePagePosition {
|
|
95
|
+
left: number;
|
|
96
|
+
top: number;
|
|
97
|
+
width: number;
|
|
98
|
+
height: number;
|
|
99
|
+
}
|
|
100
|
+
export declare function size(element: HTMLElement, width: number, height: number): void;
|
|
101
|
+
export declare function position(element: HTMLElement, top: number, right?: number, bottom?: number, left?: number, position?: string): void;
|
|
102
|
+
/**
|
|
103
|
+
* Returns the position of a dom node relative to the entire page.
|
|
104
|
+
*/
|
|
105
|
+
export declare function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition;
|
|
106
|
+
export interface IStandardWindow {
|
|
107
|
+
readonly scrollX: number;
|
|
108
|
+
readonly scrollY: number;
|
|
109
|
+
}
|
|
110
|
+
export declare const StandardWindow: IStandardWindow;
|
|
111
|
+
export declare function getTotalWidth(element: HTMLElement): number;
|
|
112
|
+
export declare function getContentWidth(element: HTMLElement): number;
|
|
113
|
+
export declare function getTotalScrollWidth(element: HTMLElement): number;
|
|
114
|
+
export declare function getContentHeight(element: HTMLElement): number;
|
|
115
|
+
export declare function getTotalHeight(element: HTMLElement): number;
|
|
116
|
+
export declare function getLargestChildWidth(parent: HTMLElement, children: HTMLElement[]): number;
|
|
117
|
+
export declare function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean;
|
|
118
|
+
export declare function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null;
|
|
119
|
+
export declare function createStyleSheet(container?: HTMLElement): HTMLStyleElement;
|
|
120
|
+
export declare function createCSSRule(selector: string, cssText: string, style?: HTMLStyleElement): void;
|
|
121
|
+
export declare function removeCSSRulesContainingSelector(ruleName: string, style?: HTMLStyleElement): void;
|
|
122
|
+
export declare function isHTMLElement(o: any): o is HTMLElement;
|
|
123
|
+
export declare const EventType: {
|
|
124
|
+
readonly CLICK: "click";
|
|
125
|
+
readonly AUXCLICK: "auxclick";
|
|
126
|
+
readonly DBLCLICK: "dblclick";
|
|
127
|
+
readonly MOUSE_UP: "mouseup";
|
|
128
|
+
readonly MOUSE_DOWN: "mousedown";
|
|
129
|
+
readonly MOUSE_OVER: "mouseover";
|
|
130
|
+
readonly MOUSE_MOVE: "mousemove";
|
|
131
|
+
readonly MOUSE_OUT: "mouseout";
|
|
132
|
+
readonly MOUSE_ENTER: "mouseenter";
|
|
133
|
+
readonly MOUSE_LEAVE: "mouseleave";
|
|
134
|
+
readonly MOUSE_WHEEL: "wheel";
|
|
135
|
+
readonly POINTER_UP: "pointerup";
|
|
136
|
+
readonly POINTER_DOWN: "pointerdown";
|
|
137
|
+
readonly POINTER_MOVE: "pointermove";
|
|
138
|
+
readonly POINTER_LEAVE: "pointerleave";
|
|
139
|
+
readonly CONTEXT_MENU: "contextmenu";
|
|
140
|
+
readonly WHEEL: "wheel";
|
|
141
|
+
readonly KEY_DOWN: "keydown";
|
|
142
|
+
readonly KEY_PRESS: "keypress";
|
|
143
|
+
readonly KEY_UP: "keyup";
|
|
144
|
+
readonly LOAD: "load";
|
|
145
|
+
readonly BEFORE_UNLOAD: "beforeunload";
|
|
146
|
+
readonly UNLOAD: "unload";
|
|
147
|
+
readonly PAGE_SHOW: "pageshow";
|
|
148
|
+
readonly PAGE_HIDE: "pagehide";
|
|
149
|
+
readonly ABORT: "abort";
|
|
150
|
+
readonly ERROR: "error";
|
|
151
|
+
readonly RESIZE: "resize";
|
|
152
|
+
readonly SCROLL: "scroll";
|
|
153
|
+
readonly FULLSCREEN_CHANGE: "fullscreenchange";
|
|
154
|
+
readonly WK_FULLSCREEN_CHANGE: "webkitfullscreenchange";
|
|
155
|
+
readonly SELECT: "select";
|
|
156
|
+
readonly CHANGE: "change";
|
|
157
|
+
readonly SUBMIT: "submit";
|
|
158
|
+
readonly RESET: "reset";
|
|
159
|
+
readonly FOCUS: "focus";
|
|
160
|
+
readonly FOCUS_IN: "focusin";
|
|
161
|
+
readonly FOCUS_OUT: "focusout";
|
|
162
|
+
readonly BLUR: "blur";
|
|
163
|
+
readonly INPUT: "input";
|
|
164
|
+
readonly STORAGE: "storage";
|
|
165
|
+
readonly DRAG_START: "dragstart";
|
|
166
|
+
readonly DRAG: "drag";
|
|
167
|
+
readonly DRAG_ENTER: "dragenter";
|
|
168
|
+
readonly DRAG_LEAVE: "dragleave";
|
|
169
|
+
readonly DRAG_OVER: "dragover";
|
|
170
|
+
readonly DROP: "drop";
|
|
171
|
+
readonly DRAG_END: "dragend";
|
|
172
|
+
readonly ANIMATION_START: "animationstart" | "webkitAnimationStart";
|
|
173
|
+
readonly ANIMATION_END: "animationend" | "webkitAnimationEnd";
|
|
174
|
+
readonly ANIMATION_ITERATION: "animationiteration" | "webkitAnimationIteration";
|
|
175
|
+
};
|
|
176
|
+
export interface EventLike {
|
|
177
|
+
preventDefault(): void;
|
|
178
|
+
stopPropagation(): void;
|
|
179
|
+
}
|
|
180
|
+
export declare const EventHelper: {
|
|
181
|
+
stop: (e: EventLike, cancelBubble?: boolean) => void;
|
|
182
|
+
};
|
|
183
|
+
export interface IFocusTracker {
|
|
184
|
+
onDidFocus: Event<void>;
|
|
185
|
+
onDidBlur: Event<void>;
|
|
186
|
+
dispose(): void;
|
|
187
|
+
}
|
|
188
|
+
export declare function saveParentsScrollTop(node: Element): number[];
|
|
189
|
+
export declare function restoreParentsScrollTop(node: Element, state: number[]): void;
|
|
190
|
+
export declare function trackFocus(element: HTMLElement | Window): IFocusTracker;
|
|
191
|
+
export declare function append<T extends Node>(parent: HTMLElement, ...children: T[]): T;
|
|
192
|
+
export declare function prepend<T extends Node>(parent: HTMLElement, child: T): T;
|
|
193
|
+
export declare function $<T extends HTMLElement>(description: string, attrs?: {
|
|
194
|
+
[key: string]: any;
|
|
195
|
+
}, ...children: Array<Node | string>): T;
|
|
196
|
+
export declare function join(nodes: Node[], separator: Node | string): Node[];
|
|
197
|
+
export declare function show(...elements: HTMLElement[]): void;
|
|
198
|
+
export declare function hide(...elements: HTMLElement[]): void;
|
|
199
|
+
export declare function removeTabIndexAndUpdateFocus(node: HTMLElement): void;
|
|
200
|
+
export declare function getElementsByTagName(tag: string): HTMLElement[];
|
|
201
|
+
export declare function finalHandler<T extends DOMEvent>(fn: (event: T) => any): (event: T) => any;
|
|
202
|
+
export declare function domContentLoaded(): Promise<any>;
|
|
203
|
+
/**
|
|
204
|
+
* Find a value usable for a dom node size such that the likelihood that it would be
|
|
205
|
+
* displayed with constant screen pixels size is as high as possible.
|
|
206
|
+
*
|
|
207
|
+
* e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio
|
|
208
|
+
* of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/"snaps"
|
|
209
|
+
* with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.
|
|
210
|
+
*/
|
|
211
|
+
export declare function computeScreenAwareSize(cssPx: number): number;
|
|
212
|
+
/**
|
|
213
|
+
* See https://github.com/Microsoft/monaco-editor/issues/601
|
|
214
|
+
* To protect against malicious code in the linked site, particularly phishing attempts,
|
|
215
|
+
* the window.opener should be set to null to prevent the linked site from having access
|
|
216
|
+
* to change the location of the current page.
|
|
217
|
+
* See https://mathiasbynens.github.io/rel-noopener/
|
|
218
|
+
*/
|
|
219
|
+
export declare function windowOpenNoOpener(url: string): void;
|
|
220
|
+
export declare function animate(fn: () => void): IDisposable;
|
|
221
|
+
export {};
|