custom-electron-titlebar 3.2.5 → 3.2.9
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/.vscode/launch.json +49 -0
- package/.vscode/tasks.json +34 -0
- package/README.md +15 -24
- package/_config.yml +1 -0
- package/{lib → build}/browser/browser.d.ts +0 -0
- package/{lib → build}/browser/browser.js +1 -0
- package/build/browser/browser.js.map +1 -0
- package/{lib → build}/browser/event.d.ts +0 -0
- package/{lib → build}/browser/event.js +3 -1
- package/build/browser/event.js.map +1 -0
- package/{lib → build}/browser/iframe.d.ts +0 -0
- package/{lib/base → build}/browser/iframe.js +1 -0
- package/build/browser/iframe.js.map +1 -0
- package/{lib → build}/browser/keyboardEvent.d.ts +0 -0
- package/{lib → build}/browser/keyboardEvent.js +1 -0
- package/build/browser/keyboardEvent.js.map +1 -0
- package/{lib → build}/browser/mouseEvent.d.ts +0 -0
- package/{lib → build}/browser/mouseEvent.js +1 -0
- package/build/browser/mouseEvent.js.map +1 -0
- package/{lib → build}/common/arrays.d.ts +0 -0
- package/{lib → build}/common/arrays.js +1 -0
- package/build/common/arrays.js.map +1 -0
- package/{lib → build}/common/async.d.ts +0 -0
- package/{lib → build}/common/async.js +1 -0
- package/build/common/async.js.map +1 -0
- package/{lib → build}/common/charCode.d.ts +0 -0
- package/{lib/base → build}/common/charCode.js +1 -0
- package/build/common/charCode.js.map +1 -0
- package/{lib → build}/common/color.d.ts +0 -0
- package/{lib → build}/common/color.js +1 -0
- package/build/common/color.js.map +1 -0
- package/{lib → build}/common/dom.d.ts +0 -0
- package/{lib → build}/common/dom.js +17 -14
- package/build/common/dom.js.map +1 -0
- package/{lib → build}/common/event.d.ts +0 -0
- package/{lib → build}/common/event.js +2 -1
- package/build/common/event.js.map +1 -0
- package/{lib → build}/common/iterator.d.ts +0 -0
- package/{lib → build}/common/iterator.js +1 -0
- package/build/common/iterator.js.map +1 -0
- package/{lib → build}/common/keyCodes.d.ts +0 -0
- package/{lib → build}/common/keyCodes.js +1 -0
- package/build/common/keyCodes.js.map +1 -0
- package/{lib → build}/common/lifecycle.d.ts +0 -0
- package/{lib → build}/common/lifecycle.js +1 -0
- package/build/common/lifecycle.js.map +1 -0
- package/{lib → build}/common/linkedList.d.ts +0 -0
- package/{lib → build}/common/linkedList.js +1 -0
- package/build/common/linkedList.js.map +1 -0
- package/{lib → build}/common/platform.d.ts +0 -0
- package/{lib → build}/common/platform.js +1 -0
- package/build/common/platform.js.map +1 -0
- package/{lib → build}/index.d.ts +0 -0
- package/{lib → build}/index.js +1 -0
- package/build/index.js.map +1 -0
- package/{lib → build}/menu/menu.d.ts +0 -0
- package/{lib → build}/menu/menu.js +39 -38
- package/build/menu/menu.js.map +1 -0
- package/{lib → build}/menu/menuitem.d.ts +10 -2
- package/{lib → build}/menu/menuitem.js +71 -29
- package/build/menu/menuitem.js.map +1 -0
- package/{lib → build}/menubar.d.ts +0 -0
- package/{lib → build}/menubar.js +38 -34
- package/build/menubar.js.map +1 -0
- package/{lib → build}/themebar.d.ts +0 -0
- package/{lib → build}/themebar.js +31 -2
- package/build/themebar.js.map +1 -0
- package/{lib → build}/titlebar.d.ts +0 -0
- package/{lib → build}/titlebar.js +72 -59
- package/build/titlebar.js.map +1 -0
- package/package.json +13 -7
- package/lib/base/browser/browser.d.ts +0 -25
- package/lib/base/browser/browser.js +0 -117
- package/lib/base/browser/canIUse.d.ts +0 -18
- package/lib/base/browser/canIUse.js +0 -63
- package/lib/base/browser/dom.d.ts +0 -230
- package/lib/base/browser/dom.js +0 -1080
- package/lib/base/browser/event.d.ts +0 -12
- package/lib/base/browser/event.js +0 -28
- package/lib/base/browser/iframe.d.ts +0 -33
- package/lib/base/browser/keyboardEvent.d.ts +0 -40
- package/lib/base/browser/keyboardEvent.js +0 -256
- package/lib/base/browser/mouseEvent.d.ts +0 -69
- package/lib/base/browser/mouseEvent.js +0 -146
- package/lib/base/common/arrays.d.ts +0 -149
- package/lib/base/common/arrays.js +0 -549
- package/lib/base/common/async.d.ts +0 -259
- package/lib/base/common/async.js +0 -728
- package/lib/base/common/cancellation.d.ts +0 -29
- package/lib/base/common/cancellation.js +0 -114
- package/lib/base/common/charCode.d.ts +0 -415
- package/lib/base/common/color.d.ts +0 -163
- package/lib/base/common/color.js +0 -495
- package/lib/base/common/errors.d.ts +0 -65
- package/lib/base/common/errors.js +0 -164
- package/lib/base/common/event.d.ts +0 -248
- package/lib/base/common/event.js +0 -703
- package/lib/base/common/functional.d.ts +0 -1
- package/lib/base/common/functional.js +0 -21
- package/lib/base/common/iterator.d.ts +0 -16
- package/lib/base/common/iterator.js +0 -82
- package/lib/base/common/keyCodes.d.ts +0 -268
- package/lib/base/common/keyCodes.js +0 -292
- package/lib/base/common/lifecycle.d.ts +0 -67
- package/lib/base/common/lifecycle.js +0 -234
- package/lib/base/common/linkedList.d.ts +0 -16
- package/lib/base/common/linkedList.js +0 -128
- package/lib/base/common/network.d.ts +0 -65
- package/lib/base/common/network.js +0 -124
- package/lib/base/common/path.d.ts +0 -39
- package/lib/base/common/path.js +0 -1407
- package/lib/base/common/platform.d.ts +0 -53
- package/lib/base/common/platform.js +0 -176
- package/lib/base/common/process.d.ts +0 -5
- package/lib/base/common/process.js +0 -18
- package/lib/base/common/sequence.d.ts +0 -27
- package/lib/base/common/sequence.js +0 -32
- package/lib/base/common/uri.d.ts +0 -153
- package/lib/base/common/uri.js +0 -612
- package/lib/browser/iframe.js +0 -109
- package/lib/common/charCode.js +0 -6
- package/lib/menu.d.ts +0 -53
- package/lib/menu.js +0 -532
- package/lib/menuitem.d.ts +0 -46
- package/lib/menuitem.js +0 -295
- package/lib/vs/base/browser/browser.d.ts +0 -25
- package/lib/vs/base/browser/browser.js +0 -117
- package/lib/vs/base/browser/canIUse.d.ts +0 -18
- package/lib/vs/base/browser/canIUse.js +0 -63
- package/lib/vs/base/browser/dom.d.ts +0 -230
- package/lib/vs/base/browser/dom.js +0 -1080
- package/lib/vs/base/browser/event.d.ts +0 -12
- package/lib/vs/base/browser/event.js +0 -28
- package/lib/vs/base/browser/iframe.d.ts +0 -33
- package/lib/vs/base/browser/iframe.js +0 -109
- package/lib/vs/base/browser/keyboardEvent.d.ts +0 -40
- package/lib/vs/base/browser/keyboardEvent.js +0 -256
- package/lib/vs/base/browser/mouseEvent.d.ts +0 -69
- package/lib/vs/base/browser/mouseEvent.js +0 -146
- package/lib/vs/base/common/arrays.d.ts +0 -149
- package/lib/vs/base/common/arrays.js +0 -549
- package/lib/vs/base/common/async.d.ts +0 -259
- package/lib/vs/base/common/async.js +0 -728
- package/lib/vs/base/common/cancellation.d.ts +0 -29
- package/lib/vs/base/common/cancellation.js +0 -114
- package/lib/vs/base/common/charCode.d.ts +0 -415
- package/lib/vs/base/common/charCode.js +0 -6
- package/lib/vs/base/common/color.d.ts +0 -163
- package/lib/vs/base/common/color.js +0 -495
- package/lib/vs/base/common/errors.d.ts +0 -65
- package/lib/vs/base/common/errors.js +0 -164
- package/lib/vs/base/common/event.d.ts +0 -248
- package/lib/vs/base/common/event.js +0 -703
- package/lib/vs/base/common/functional.d.ts +0 -1
- package/lib/vs/base/common/functional.js +0 -21
- package/lib/vs/base/common/iterator.d.ts +0 -16
- package/lib/vs/base/common/iterator.js +0 -82
- package/lib/vs/base/common/keyCodes.d.ts +0 -268
- package/lib/vs/base/common/keyCodes.js +0 -292
- package/lib/vs/base/common/lifecycle.d.ts +0 -67
- package/lib/vs/base/common/lifecycle.js +0 -234
- package/lib/vs/base/common/linkedList.d.ts +0 -16
- package/lib/vs/base/common/linkedList.js +0 -128
- package/lib/vs/base/common/network.d.ts +0 -65
- package/lib/vs/base/common/network.js +0 -124
- package/lib/vs/base/common/path.d.ts +0 -39
- package/lib/vs/base/common/path.js +0 -1407
- package/lib/vs/base/common/platform.d.ts +0 -53
- package/lib/vs/base/common/platform.js +0 -176
- package/lib/vs/base/common/process.d.ts +0 -5
- package/lib/vs/base/common/process.js +0 -18
- package/lib/vs/base/common/sequence.d.ts +0 -27
- package/lib/vs/base/common/sequence.js +0 -32
- package/lib/vs/base/common/uri.d.ts +0 -153
- package/lib/vs/base/common/uri.js +0 -612
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.StandardWheelEvent = exports.DragMouseEvent = exports.StandardMouseEvent = void 0;
|
|
27
|
-
const browser = __importStar(require("vs/base/browser/browser"));
|
|
28
|
-
const iframe_1 = require("vs/base/browser/iframe");
|
|
29
|
-
const platform = __importStar(require("vs/base/common/platform"));
|
|
30
|
-
class StandardMouseEvent {
|
|
31
|
-
constructor(e) {
|
|
32
|
-
this.timestamp = Date.now();
|
|
33
|
-
this.browserEvent = e;
|
|
34
|
-
this.leftButton = e.button === 0;
|
|
35
|
-
this.middleButton = e.button === 1;
|
|
36
|
-
this.rightButton = e.button === 2;
|
|
37
|
-
this.buttons = e.buttons;
|
|
38
|
-
this.target = e.target;
|
|
39
|
-
this.detail = e.detail || 1;
|
|
40
|
-
if (e.type === 'dblclick') {
|
|
41
|
-
this.detail = 2;
|
|
42
|
-
}
|
|
43
|
-
this.ctrlKey = e.ctrlKey;
|
|
44
|
-
this.shiftKey = e.shiftKey;
|
|
45
|
-
this.altKey = e.altKey;
|
|
46
|
-
this.metaKey = e.metaKey;
|
|
47
|
-
if (typeof e.pageX === 'number') {
|
|
48
|
-
this.posx = e.pageX;
|
|
49
|
-
this.posy = e.pageY;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
// Probably hit by MSGestureEvent
|
|
53
|
-
this.posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
|
|
54
|
-
this.posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
|
|
55
|
-
}
|
|
56
|
-
// Find the position of the iframe this code is executing in relative to the iframe where the event was captured.
|
|
57
|
-
let iframeOffsets = iframe_1.IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(self, e.view);
|
|
58
|
-
this.posx -= iframeOffsets.left;
|
|
59
|
-
this.posy -= iframeOffsets.top;
|
|
60
|
-
}
|
|
61
|
-
preventDefault() {
|
|
62
|
-
this.browserEvent.preventDefault();
|
|
63
|
-
}
|
|
64
|
-
stopPropagation() {
|
|
65
|
-
this.browserEvent.stopPropagation();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.StandardMouseEvent = StandardMouseEvent;
|
|
69
|
-
class DragMouseEvent extends StandardMouseEvent {
|
|
70
|
-
constructor(e) {
|
|
71
|
-
super(e);
|
|
72
|
-
this.dataTransfer = e.dataTransfer;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.DragMouseEvent = DragMouseEvent;
|
|
76
|
-
class StandardWheelEvent {
|
|
77
|
-
constructor(e, deltaX = 0, deltaY = 0) {
|
|
78
|
-
this.browserEvent = e || null;
|
|
79
|
-
this.target = e ? (e.target || e.targetNode || e.srcElement) : null;
|
|
80
|
-
this.deltaY = deltaY;
|
|
81
|
-
this.deltaX = deltaX;
|
|
82
|
-
if (e) {
|
|
83
|
-
// Old (deprecated) wheel events
|
|
84
|
-
let e1 = e;
|
|
85
|
-
let e2 = e;
|
|
86
|
-
// vertical delta scroll
|
|
87
|
-
if (typeof e1.wheelDeltaY !== 'undefined') {
|
|
88
|
-
this.deltaY = e1.wheelDeltaY / 120;
|
|
89
|
-
}
|
|
90
|
-
else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
|
|
91
|
-
this.deltaY = -e2.detail / 3;
|
|
92
|
-
}
|
|
93
|
-
else if (e.type === 'wheel') {
|
|
94
|
-
// Modern wheel event
|
|
95
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
|
|
96
|
-
const ev = e;
|
|
97
|
-
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
|
|
98
|
-
// the deltas are expressed in lines
|
|
99
|
-
this.deltaY = -e.deltaY;
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
this.deltaY = -e.deltaY / 40;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
// horizontal delta scroll
|
|
106
|
-
if (typeof e1.wheelDeltaX !== 'undefined') {
|
|
107
|
-
if (browser.isSafari && platform.isWindows) {
|
|
108
|
-
this.deltaX = -(e1.wheelDeltaX / 120);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
this.deltaX = e1.wheelDeltaX / 120;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
|
|
115
|
-
this.deltaX = -e.detail / 3;
|
|
116
|
-
}
|
|
117
|
-
else if (e.type === 'wheel') {
|
|
118
|
-
// Modern wheel event
|
|
119
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
|
|
120
|
-
const ev = e;
|
|
121
|
-
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
|
|
122
|
-
// the deltas are expressed in lines
|
|
123
|
-
this.deltaX = -e.deltaX;
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
this.deltaX = -e.deltaX / 40;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// Assume a vertical scroll if nothing else worked
|
|
130
|
-
if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {
|
|
131
|
-
this.deltaY = e.wheelDelta / 120;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
preventDefault() {
|
|
136
|
-
if (this.browserEvent) {
|
|
137
|
-
this.browserEvent.preventDefault();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
stopPropagation() {
|
|
141
|
-
if (this.browserEvent) {
|
|
142
|
-
this.browserEvent.stopPropagation();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
exports.StandardWheelEvent = StandardWheelEvent;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { CancellationToken } from 'vs/base/common/cancellation';
|
|
2
|
-
import { ISplice } from 'vs/base/common/sequence';
|
|
3
|
-
/**
|
|
4
|
-
* Returns the last element of an array.
|
|
5
|
-
* @param array The array.
|
|
6
|
-
* @param n Which element from the end (default is zero).
|
|
7
|
-
*/
|
|
8
|
-
export declare function tail<T>(array: ArrayLike<T>, n?: number): T;
|
|
9
|
-
export declare function tail2<T>(arr: T[]): [T[], T];
|
|
10
|
-
export declare function equals<T>(one: ReadonlyArray<T> | undefined, other: ReadonlyArray<T> | undefined, itemEquals?: (a: T, b: T) => boolean): boolean;
|
|
11
|
-
export declare function binarySearch<T>(array: ReadonlyArray<T>, key: T, comparator: (op1: T, op2: T) => number): number;
|
|
12
|
-
/**
|
|
13
|
-
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
|
|
14
|
-
* are located before all elements where p(x) is true.
|
|
15
|
-
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
|
|
16
|
-
*/
|
|
17
|
-
export declare function findFirstInSorted<T>(array: ReadonlyArray<T>, p: (x: T) => boolean): number;
|
|
18
|
-
declare type Compare<T> = (a: T, b: T) => number;
|
|
19
|
-
/**
|
|
20
|
-
* Like `Array#sort` but always stable. Usually runs a little slower `than Array#sort`
|
|
21
|
-
* so only use this when actually needing stable sort.
|
|
22
|
-
*/
|
|
23
|
-
export declare function mergeSort<T>(data: T[], compare: Compare<T>): T[];
|
|
24
|
-
export declare function groupBy<T>(data: ReadonlyArray<T>, compare: (a: T, b: T) => number): T[][];
|
|
25
|
-
/**
|
|
26
|
-
* Diffs two *sorted* arrays and computes the splices which apply the diff.
|
|
27
|
-
*/
|
|
28
|
-
export declare function sortedDiff<T>(before: ReadonlyArray<T>, after: ReadonlyArray<T>, compare: (a: T, b: T) => number): ISplice<T>[];
|
|
29
|
-
/**
|
|
30
|
-
* Takes two *sorted* arrays and computes their delta (removed, added elements).
|
|
31
|
-
* Finishes in `Math.min(before.length, after.length)` steps.
|
|
32
|
-
*/
|
|
33
|
-
export declare function delta<T>(before: ReadonlyArray<T>, after: ReadonlyArray<T>, compare: (a: T, b: T) => number): {
|
|
34
|
-
removed: T[];
|
|
35
|
-
added: T[];
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Returns the top N elements from the array.
|
|
39
|
-
*
|
|
40
|
-
* Faster than sorting the entire array when the array is a lot larger than N.
|
|
41
|
-
*
|
|
42
|
-
* @param array The unsorted array.
|
|
43
|
-
* @param compare A sort function for the elements.
|
|
44
|
-
* @param n The number of elements to return.
|
|
45
|
-
* @return The first n elemnts from array when sorted with compare.
|
|
46
|
-
*/
|
|
47
|
-
export declare function top<T>(array: ReadonlyArray<T>, compare: (a: T, b: T) => number, n: number): T[];
|
|
48
|
-
/**
|
|
49
|
-
* Asynchronous variant of `top()` allowing for splitting up work in batches between which the event loop can run.
|
|
50
|
-
*
|
|
51
|
-
* Returns the top N elements from the array.
|
|
52
|
-
*
|
|
53
|
-
* Faster than sorting the entire array when the array is a lot larger than N.
|
|
54
|
-
*
|
|
55
|
-
* @param array The unsorted array.
|
|
56
|
-
* @param compare A sort function for the elements.
|
|
57
|
-
* @param n The number of elements to return.
|
|
58
|
-
* @param batch The number of elements to examine before yielding to the event loop.
|
|
59
|
-
* @return The first n elemnts from array when sorted with compare.
|
|
60
|
-
*/
|
|
61
|
-
export declare function topAsync<T>(array: T[], compare: (a: T, b: T) => number, n: number, batch: number, token?: CancellationToken): Promise<T[]>;
|
|
62
|
-
/**
|
|
63
|
-
* @returns New array with all falsy values removed. The original array IS NOT modified.
|
|
64
|
-
*/
|
|
65
|
-
export declare function coalesce<T>(array: ReadonlyArray<T | undefined | null>): T[];
|
|
66
|
-
/**
|
|
67
|
-
* Remove all falsey values from `array`. The original array IS modified.
|
|
68
|
-
*/
|
|
69
|
-
export declare function coalesceInPlace<T>(array: Array<T | undefined | null>): void;
|
|
70
|
-
/**
|
|
71
|
-
* Moves the element in the array for the provided positions.
|
|
72
|
-
*/
|
|
73
|
-
export declare function move(array: any[], from: number, to: number): void;
|
|
74
|
-
/**
|
|
75
|
-
* @returns false if the provided object is an array and not empty.
|
|
76
|
-
*/
|
|
77
|
-
export declare function isFalsyOrEmpty(obj: any): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* @returns True if the provided object is an array and has at least one element.
|
|
80
|
-
*/
|
|
81
|
-
export declare function isNonEmptyArray<T>(obj: T[] | undefined | null): obj is T[];
|
|
82
|
-
export declare function isNonEmptyArray<T>(obj: readonly T[] | undefined | null): obj is readonly T[];
|
|
83
|
-
/**
|
|
84
|
-
* Removes duplicates from the given array. The optional keyFn allows to specify
|
|
85
|
-
* how elements are checked for equalness by returning a unique string for each.
|
|
86
|
-
*/
|
|
87
|
-
export declare function distinct<T>(array: ReadonlyArray<T>, keyFn?: (t: T) => string): T[];
|
|
88
|
-
export declare function distinctES6<T>(array: ReadonlyArray<T>): T[];
|
|
89
|
-
export declare function uniqueFilter<T>(keyFn: (t: T) => string): (t: T) => boolean;
|
|
90
|
-
export declare function lastIndex<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean): number;
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated ES6: use `Array.findIndex`
|
|
93
|
-
*/
|
|
94
|
-
export declare function firstIndex<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean): number;
|
|
95
|
-
/**
|
|
96
|
-
* @deprecated ES6: use `Array.find`
|
|
97
|
-
*/
|
|
98
|
-
export declare function first<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean, notFoundValue: T): T;
|
|
99
|
-
export declare function first<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean): T | undefined;
|
|
100
|
-
export declare function firstOrDefault<T, NotFound = T>(array: ReadonlyArray<T>, notFoundValue: NotFound): T | NotFound;
|
|
101
|
-
export declare function firstOrDefault<T>(array: ReadonlyArray<T>): T | undefined;
|
|
102
|
-
export declare function commonPrefixLength<T>(one: ReadonlyArray<T>, other: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): number;
|
|
103
|
-
export declare function flatten<T>(arr: T[][]): T[];
|
|
104
|
-
export declare function range(to: number): number[];
|
|
105
|
-
export declare function range(from: number, to: number): number[];
|
|
106
|
-
export declare function index<T>(array: ReadonlyArray<T>, indexer: (t: T) => string): {
|
|
107
|
-
[key: string]: T;
|
|
108
|
-
};
|
|
109
|
-
export declare function index<T, R>(array: ReadonlyArray<T>, indexer: (t: T) => string, mapper: (t: T) => R): {
|
|
110
|
-
[key: string]: R;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Inserts an element into an array. Returns a function which, when
|
|
114
|
-
* called, will remove that element from the array.
|
|
115
|
-
*/
|
|
116
|
-
export declare function insert<T>(array: T[], element: T): () => void;
|
|
117
|
-
/**
|
|
118
|
-
* Removes an element from an array if it can be found.
|
|
119
|
-
*/
|
|
120
|
-
export declare function remove<T>(array: T[], element: T): T | undefined;
|
|
121
|
-
/**
|
|
122
|
-
* Insert `insertArr` inside `target` at `insertIndex`.
|
|
123
|
-
* Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array
|
|
124
|
-
*/
|
|
125
|
-
export declare function arrayInsert<T>(target: T[], insertIndex: number, insertArr: T[]): T[];
|
|
126
|
-
/**
|
|
127
|
-
* Uses Fisher-Yates shuffle to shuffle the given array
|
|
128
|
-
*/
|
|
129
|
-
export declare function shuffle<T>(array: T[], _seed?: number): void;
|
|
130
|
-
/**
|
|
131
|
-
* Pushes an element to the start of the array, if found.
|
|
132
|
-
*/
|
|
133
|
-
export declare function pushToStart<T>(arr: T[], value: T): void;
|
|
134
|
-
/**
|
|
135
|
-
* Pushes an element to the end of the array, if found.
|
|
136
|
-
*/
|
|
137
|
-
export declare function pushToEnd<T>(arr: T[], value: T): void;
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated ES6: use `Array.find`
|
|
140
|
-
*/
|
|
141
|
-
export declare function find<T>(arr: ArrayLike<T>, predicate: (value: T, index: number, arr: ArrayLike<T>) => any): T | undefined;
|
|
142
|
-
export declare function mapArrayOrNot<T, U>(items: T | T[], fn: (_: T) => U): U | U[];
|
|
143
|
-
export declare function asArray<T>(x: T | T[]): T[];
|
|
144
|
-
/**
|
|
145
|
-
* @deprecated Use `Array.from` or `[...iter]`
|
|
146
|
-
*/
|
|
147
|
-
export declare function toArray<T>(iterable: IterableIterator<T>): T[];
|
|
148
|
-
export declare function getRandomElement<T>(arr: T[]): T | undefined;
|
|
149
|
-
export {};
|