@paulirish/trace_engine 0.0.16 → 0.0.18
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/README.md +17 -22
- package/core/platform/ArrayUtilities.js.map +1 -1
- package/core/platform/DOMUtilities.js.map +1 -1
- package/core/platform/MapUtilities.d.ts +1 -0
- package/core/platform/MapUtilities.js +3 -0
- package/core/platform/MapUtilities.js.map +1 -1
- package/core/platform/MimeType.js +1 -0
- package/core/platform/MimeType.js.map +1 -1
- package/core/platform/NumberUtilities.js.map +1 -1
- package/core/platform/SetUtilities.js.map +1 -1
- package/core/platform/StringUtilities.js.map +1 -1
- package/core/platform/TypescriptUtilities.js.map +1 -1
- package/core/platform/UserVisibleError.js.map +1 -1
- package/generated/protocol.d.ts +100 -34
- package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
- package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
- package/models/trace/EntriesFilter.d.ts +6 -1
- package/models/trace/EntriesFilter.js +11 -2
- package/models/trace/EntriesFilter.js.map +1 -1
- package/models/trace/LegacyTracingModel.js.map +1 -1
- package/models/trace/ModelImpl.js.map +1 -1
- package/models/trace/Processor.js +38 -32
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/TracingManager.js.map +1 -1
- package/models/trace/extras/FetchNodes.d.ts +1 -1
- package/models/trace/extras/FetchNodes.js +1 -2
- package/models/trace/extras/FetchNodes.js.map +1 -1
- package/models/trace/extras/FilmStrip.js.map +1 -1
- package/models/trace/extras/MainThreadActivity.js.map +1 -1
- package/models/trace/extras/Metadata.d.ts +2 -2
- package/models/trace/extras/Metadata.js +10 -2
- package/models/trace/extras/Metadata.js.map +1 -1
- package/models/trace/handlers/AnimationHandler.js +1 -1
- package/models/trace/handlers/AnimationHandler.js.map +1 -1
- package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -1
- package/models/trace/handlers/FramesHandler.js.map +1 -1
- package/models/trace/handlers/GPUHandler.js +1 -1
- package/models/trace/handlers/GPUHandler.js.map +1 -1
- package/models/trace/handlers/InitiatorsHandler.js +32 -3
- package/models/trace/handlers/InitiatorsHandler.js.map +1 -1
- package/models/trace/handlers/InvalidationsHandler.js +1 -1
- package/models/trace/handlers/InvalidationsHandler.js.map +1 -1
- package/models/trace/handlers/LargestImagePaintHandler.js +1 -1
- package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -1
- package/models/trace/handlers/LargestTextPaintHandler.js +1 -1
- package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -1
- package/models/trace/handlers/LayerTreeHandler.js +3 -3
- package/models/trace/handlers/LayerTreeHandler.js.map +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +5 -5
- package/models/trace/handlers/LayoutShiftsHandler.js +6 -5
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
- package/models/trace/handlers/MemoryHandler.js +1 -1
- package/models/trace/handlers/MemoryHandler.js.map +1 -1
- package/models/trace/handlers/MetaHandler.js +8 -8
- package/models/trace/handlers/MetaHandler.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.js +2 -2
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/PageLoadMetricsHandler.d.ts +11 -0
- package/models/trace/handlers/PageLoadMetricsHandler.js +9 -14
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
- package/models/trace/handlers/RendererHandler.js.map +1 -1
- package/models/trace/handlers/SamplesHandler.js +2 -2
- package/models/trace/handlers/SamplesHandler.js.map +1 -1
- package/models/trace/handlers/ScreenshotsHandler.js +2 -1
- package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
- package/models/trace/handlers/Threads.js.map +1 -1
- package/models/trace/handlers/UserInteractionsHandler.d.ts +2 -0
- package/models/trace/handlers/UserInteractionsHandler.js +21 -11
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
- package/models/trace/handlers/UserTimingsHandler.js +1 -0
- package/models/trace/handlers/UserTimingsHandler.js.map +1 -1
- package/models/trace/handlers/WarningsHandler.js +2 -2
- package/models/trace/handlers/WarningsHandler.js.map +1 -1
- package/models/trace/handlers/WorkersHandler.js +3 -3
- package/models/trace/handlers/WorkersHandler.js.map +1 -1
- package/models/trace/handlers/types.js.map +1 -1
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
- package/models/trace/helpers/Timing.js.map +1 -1
- package/models/trace/helpers/Trace.js.map +1 -1
- package/models/trace/helpers/TreeHelpers.js.map +1 -1
- package/models/trace/insights/InsightRunners.d.ts +2 -0
- package/models/trace/insights/InsightRunners.js +2 -0
- package/models/trace/insights/InsightRunners.js.map +1 -1
- package/models/trace/insights/InteractionToNextPaint.d.ts +9 -0
- package/models/trace/insights/InteractionToNextPaint.js +35 -0
- package/models/trace/insights/InteractionToNextPaint.js.map +1 -0
- package/models/trace/insights/LargestContentfulPaint.d.ts +31 -0
- package/models/trace/insights/LargestContentfulPaint.js +104 -0
- package/models/trace/insights/LargestContentfulPaint.js.map +1 -0
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/insights/insights-tsconfig.json +2 -0
- package/models/trace/insights/types.d.ts +3 -1
- package/models/trace/insights/types.js +3 -0
- package/models/trace/insights/types.js.map +1 -1
- package/models/trace/root-causes/LayoutShift.d.ts +2 -2
- package/models/trace/root-causes/LayoutShift.js +19 -14
- package/models/trace/root-causes/LayoutShift.js.map +1 -1
- package/models/trace/root-causes/RootCauses.d.ts +1 -1
- package/models/trace/root-causes/RootCauses.js.map +1 -1
- package/models/trace/types/Configuration.js +10 -2
- package/models/trace/types/Configuration.js.map +1 -1
- package/models/trace/types/File.d.ts +6 -0
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +23 -1
- package/models/trace/types/TraceEvents.js +6 -0
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/package.json +1 -1
- package/PAUL.readme.md +0 -5
- package/core/platform/array-utilities.d.ts +0 -66
- package/core/platform/array-utilities.js +0 -199
- package/core/platform/array-utilities.js.map +0 -1
- package/core/platform/date-utilities.d.ts +0 -2
- package/core/platform/date-utilities.js +0 -14
- package/core/platform/date-utilities.js.map +0 -1
- package/core/platform/dcheck-tsconfig.json +0 -8
- package/core/platform/dcheck.d.ts +0 -4
- package/core/platform/dcheck.js +0 -5
- package/core/platform/dom-utilities.d.ts +0 -8
- package/core/platform/dom-utilities.js +0 -109
- package/core/platform/dom-utilities.js.map +0 -1
- package/core/platform/keyboard-utilities.d.ts +0 -17
- package/core/platform/keyboard-utilities.js +0 -22
- package/core/platform/keyboard-utilities.js.map +0 -1
- package/core/platform/map-utilities.d.ts +0 -18
- package/core/platform/map-utilities.js +0 -76
- package/core/platform/map-utilities.js.map +0 -1
- package/core/platform/number-utilities.d.ts +0 -15
- package/core/platform/number-utilities.js +0 -82
- package/core/platform/number-utilities.js.map +0 -1
- package/core/platform/promise-utilities.d.ts +0 -10
- package/core/platform/promise-utilities.js +0 -18
- package/core/platform/promise-utilities.js.map +0 -1
- package/core/platform/set-utilities.d.ts +0 -2
- package/core/platform/set-utilities.js +0 -23
- package/core/platform/set-utilities.js.map +0 -1
- package/core/platform/string-utilities.d.ts +0 -71
- package/core/platform/string-utilities.js +0 -513
- package/core/platform/string-utilities.js.map +0 -1
- package/core/platform/typescript-utilities.d.ts +0 -56
- package/core/platform/typescript-utilities.js +0 -25
- package/core/platform/typescript-utilities.js.map +0 -1
- /package/core/platform/{brand.d.ts → Brand.d.ts} +0 -0
- /package/core/platform/{brand.js → Brand.js} +0 -0
- /package/core/platform/{brand.js.map → Brand.js.map} +0 -0
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2020 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
export const removeElement = (array, element, firstOnly) => {
|
|
5
|
-
let index = array.indexOf(element);
|
|
6
|
-
if (index === -1) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
if (firstOnly) {
|
|
10
|
-
array.splice(index, 1);
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
for (let i = index + 1, n = array.length; i < n; ++i) {
|
|
14
|
-
if (array[i] !== element) {
|
|
15
|
-
array[index++] = array[i];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
array.length = index;
|
|
19
|
-
return true;
|
|
20
|
-
};
|
|
21
|
-
function swap(array, i1, i2) {
|
|
22
|
-
const temp = array[i1];
|
|
23
|
-
array[i1] = array[i2];
|
|
24
|
-
array[i2] = temp;
|
|
25
|
-
}
|
|
26
|
-
function partition(array, comparator, left, right, pivotIndex) {
|
|
27
|
-
const pivotValue = array[pivotIndex];
|
|
28
|
-
swap(array, right, pivotIndex);
|
|
29
|
-
let storeIndex = left;
|
|
30
|
-
for (let i = left; i < right; ++i) {
|
|
31
|
-
if (comparator(array[i], pivotValue) < 0) {
|
|
32
|
-
swap(array, storeIndex, i);
|
|
33
|
-
++storeIndex;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
swap(array, right, storeIndex);
|
|
37
|
-
return storeIndex;
|
|
38
|
-
}
|
|
39
|
-
function quickSortRange(array, comparator, left, right, sortWindowLeft, sortWindowRight) {
|
|
40
|
-
if (right <= left) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const pivotIndex = Math.floor(Math.random() * (right - left)) + left;
|
|
44
|
-
const pivotNewIndex = partition(array, comparator, left, right, pivotIndex);
|
|
45
|
-
if (sortWindowLeft < pivotNewIndex) {
|
|
46
|
-
quickSortRange(array, comparator, left, pivotNewIndex - 1, sortWindowLeft, sortWindowRight);
|
|
47
|
-
}
|
|
48
|
-
if (pivotNewIndex < sortWindowRight) {
|
|
49
|
-
quickSortRange(array, comparator, pivotNewIndex + 1, right, sortWindowLeft, sortWindowRight);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export function sortRange(array, comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight) {
|
|
53
|
-
if (leftBound === 0 && rightBound === (array.length - 1) && sortWindowLeft === 0 && sortWindowRight >= rightBound) {
|
|
54
|
-
array.sort(comparator);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
quickSortRange(array, comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight);
|
|
58
|
-
}
|
|
59
|
-
return array;
|
|
60
|
-
}
|
|
61
|
-
export const binaryIndexOf = (array, value, comparator) => {
|
|
62
|
-
const index = lowerBound(array, value, comparator);
|
|
63
|
-
return index < array.length && comparator(value, array[index]) === 0 ? index : -1;
|
|
64
|
-
};
|
|
65
|
-
function mergeOrIntersect(array1, array2, comparator, mergeNotIntersect) {
|
|
66
|
-
const result = [];
|
|
67
|
-
let i = 0;
|
|
68
|
-
let j = 0;
|
|
69
|
-
while (i < array1.length && j < array2.length) {
|
|
70
|
-
const compareValue = comparator(array1[i], array2[j]);
|
|
71
|
-
if (mergeNotIntersect || !compareValue) {
|
|
72
|
-
result.push(compareValue <= 0 ? array1[i] : array2[j]);
|
|
73
|
-
}
|
|
74
|
-
if (compareValue <= 0) {
|
|
75
|
-
i++;
|
|
76
|
-
}
|
|
77
|
-
if (compareValue >= 0) {
|
|
78
|
-
j++;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (mergeNotIntersect) {
|
|
82
|
-
while (i < array1.length) {
|
|
83
|
-
result.push(array1[i++]);
|
|
84
|
-
}
|
|
85
|
-
while (j < array2.length) {
|
|
86
|
-
result.push(array2[j++]);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
export const intersectOrdered = (array1, array2, comparator) => {
|
|
92
|
-
return mergeOrIntersect(array1, array2, comparator, false);
|
|
93
|
-
};
|
|
94
|
-
export const mergeOrdered = (array1, array2, comparator) => {
|
|
95
|
-
return mergeOrIntersect(array1, array2, comparator, true);
|
|
96
|
-
};
|
|
97
|
-
export const DEFAULT_COMPARATOR = (a, b) => {
|
|
98
|
-
return a < b ? -1 : (a > b ? 1 : 0);
|
|
99
|
-
};
|
|
100
|
-
export function lowerBound(array, needle, comparator, left, right) {
|
|
101
|
-
let l = left || 0;
|
|
102
|
-
let r = right !== undefined ? right : array.length;
|
|
103
|
-
while (l < r) {
|
|
104
|
-
const m = (l + r) >> 1;
|
|
105
|
-
if (comparator(needle, array[m]) > 0) {
|
|
106
|
-
l = m + 1;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
r = m;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return r;
|
|
113
|
-
}
|
|
114
|
-
export function upperBound(array, needle, comparator, left, right) {
|
|
115
|
-
let l = left || 0;
|
|
116
|
-
let r = right !== undefined ? right : array.length;
|
|
117
|
-
while (l < r) {
|
|
118
|
-
const m = (l + r) >> 1;
|
|
119
|
-
if (comparator(needle, array[m]) >= 0) {
|
|
120
|
-
l = m + 1;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
r = m;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return r;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Obtains the first or last item in the array that satisfies the predicate function.
|
|
130
|
-
* So, for example, if the array were arr = [2, 4, 6, 8, 10], and you are looking for
|
|
131
|
-
* the last item arr[i] such that arr[i] < 5 you would be returned 1, because
|
|
132
|
-
* array[1] is 4, the last item in the array that satisfies the
|
|
133
|
-
* predicate function.
|
|
134
|
-
*
|
|
135
|
-
* If instead you were looking for the first item in the same array that satisfies
|
|
136
|
-
* arr[i] > 5 you would be returned 2 because array[2] = 6.
|
|
137
|
-
*
|
|
138
|
-
* Please note: this presupposes that the array is already ordered.
|
|
139
|
-
*/
|
|
140
|
-
function nearestIndex(arr, predicate, searchStart) {
|
|
141
|
-
const searchFromEnd = searchStart === "END" /* NearestSearchStart.END */;
|
|
142
|
-
if (arr.length === 0) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
let left = 0;
|
|
146
|
-
let right = arr.length - 1;
|
|
147
|
-
let pivot = 0;
|
|
148
|
-
let matchesPredicate = false;
|
|
149
|
-
let moveToTheRight = false;
|
|
150
|
-
let middle = 0;
|
|
151
|
-
do {
|
|
152
|
-
middle = left + (right - left) / 2;
|
|
153
|
-
pivot = searchFromEnd ? Math.ceil(middle) : Math.floor(middle);
|
|
154
|
-
matchesPredicate = predicate(arr[pivot]);
|
|
155
|
-
moveToTheRight = matchesPredicate === searchFromEnd;
|
|
156
|
-
if (moveToTheRight) {
|
|
157
|
-
left = Math.min(right, pivot + (left === pivot ? 1 : 0));
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
right = Math.max(left, pivot + (right === pivot ? -1 : 0));
|
|
161
|
-
}
|
|
162
|
-
} while (right !== left);
|
|
163
|
-
// Special-case: the indexed item doesn't pass the predicate. This
|
|
164
|
-
// occurs when none of the items in the array are a match for the
|
|
165
|
-
// predicate.
|
|
166
|
-
if (!predicate(arr[left])) {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
return left;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Obtains the first item in the array that satisfies the predicate function.
|
|
173
|
-
* So, for example, if the array was arr = [2, 4, 6, 8, 10], and you are looking for
|
|
174
|
-
* the first item arr[i] such that arr[i] > 5 you would be returned 2, because
|
|
175
|
-
* array[2] is 6, the first item in the array that satisfies the
|
|
176
|
-
* predicate function.
|
|
177
|
-
*
|
|
178
|
-
* Please note: this presupposes that the array is already ordered.
|
|
179
|
-
*/
|
|
180
|
-
export function nearestIndexFromBeginning(arr, predicate) {
|
|
181
|
-
return nearestIndex(arr, predicate, "BEGINNING" /* NearestSearchStart.BEGINNING */);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Obtains the last item in the array that satisfies the predicate function.
|
|
185
|
-
* So, for example, if the array was arr = [2, 4, 6, 8, 10], and you are looking for
|
|
186
|
-
* the last item arr[i] such that arr[i] < 5 you would be returned 1, because
|
|
187
|
-
* arr[1] is 4, the last item in the array that satisfies the
|
|
188
|
-
* predicate function.
|
|
189
|
-
*
|
|
190
|
-
* Please note: this presupposes that the array is already ordered.
|
|
191
|
-
*/
|
|
192
|
-
export function nearestIndexFromEnd(arr, predicate) {
|
|
193
|
-
return nearestIndex(arr, predicate, "END" /* NearestSearchStart.END */);
|
|
194
|
-
}
|
|
195
|
-
// Type guard for ensuring that `arr` does not contain null or undefined
|
|
196
|
-
export function arrayDoesNotContainNullOrUndefined(arr) {
|
|
197
|
-
return !arr.includes(null) && !arr.includes(undefined);
|
|
198
|
-
}
|
|
199
|
-
//# sourceMappingURL=array-utilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/array-utilities.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,6BAA6B;AAE7B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAI,KAAU,EAAE,OAAU,EAAE,SAAmB,EAAW,EAAE;IACvF,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,SAAS,EAAE;QACb,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;KACb;IACD,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QACpD,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;YACxB,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3B;KACF;IACD,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;IACrB,OAAO,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,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5D;KACF,QAAQ,KAAK,KAAK,IAAI,EAAE;IAEzB,kEAAkE;IAClE,iEAAiE;IACjE,aAAa;IACb,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE;QACzB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAI,GAAQ,EAAE,SAAoC;IACzF,OAAO,YAAY,CAAC,GAAG,EAAE,SAAS,iDAA+B,CAAC;AACpE,CAAC;AAED;;;;;;;;GAQG;AAEH,MAAM,UAAU,mBAAmB,CAAI,GAAiB,EAAE,SAAoC;IAC5F,OAAO,YAAY,CAAC,GAAG,EAAE,SAAS,qCAAyB,CAAC;AAC9D,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,kCAAkC,CAAI,GAAyB;IAC7E,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACzD,CAAC","sourcesContent":["// Copyright (c) 2020 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport const removeElement = <T>(array: T[], element: T, firstOnly?: boolean): boolean => {\n let index = array.indexOf(element);\n if (index === -1) {\n return false;\n }\n if (firstOnly) {\n array.splice(index, 1);\n return true;\n }\n for (let i = index + 1, n = array.length; i < n; ++i) {\n if (array[i] !== element) {\n array[index++] = array[i];\n }\n }\n array.length = index;\n return true;\n};\n\ntype NumberComparator = (a: number, b: number) => number;\n\nfunction swap(array: number[], i1: number, i2: number): void {\n const temp = array[i1];\n array[i1] = array[i2];\n array[i2] = temp;\n}\n\nfunction partition(\n array: number[], comparator: NumberComparator, left: number, right: number, pivotIndex: number): number {\n const pivotValue = array[pivotIndex];\n swap(array, right, pivotIndex);\n let storeIndex = left;\n for (let i = left; i < right; ++i) {\n if (comparator(array[i], pivotValue) < 0) {\n swap(array, storeIndex, i);\n ++storeIndex;\n }\n }\n swap(array, right, storeIndex);\n return storeIndex;\n}\n\nfunction quickSortRange(\n array: number[], comparator: NumberComparator, left: number, right: number, sortWindowLeft: number,\n sortWindowRight: number): void {\n if (right <= left) {\n return;\n }\n const pivotIndex = Math.floor(Math.random() * (right - left)) + left;\n const pivotNewIndex = partition(array, comparator, left, right, pivotIndex);\n if (sortWindowLeft < pivotNewIndex) {\n quickSortRange(array, comparator, left, pivotNewIndex - 1, sortWindowLeft, sortWindowRight);\n }\n if (pivotNewIndex < sortWindowRight) {\n quickSortRange(array, comparator, pivotNewIndex + 1, right, sortWindowLeft, sortWindowRight);\n }\n}\n\nexport function sortRange(\n array: number[], comparator: NumberComparator, leftBound: number, rightBound: number, sortWindowLeft: number,\n sortWindowRight: number): number[] {\n if (leftBound === 0 && rightBound === (array.length - 1) && sortWindowLeft === 0 && sortWindowRight >= rightBound) {\n array.sort(comparator);\n } else {\n quickSortRange(array, comparator, leftBound, rightBound, sortWindowLeft, sortWindowRight);\n }\n return array;\n}\nexport const binaryIndexOf = <T, S>(array: T[], value: S, comparator: (a: S, b: T) => number): number => {\n const index = lowerBound(array, value, comparator);\n return index < array.length && comparator(value, array[index]) === 0 ? index : -1;\n};\n\nfunction mergeOrIntersect<T>(\n array1: T[], array2: T[], comparator: (a: T, b: T) => number, mergeNotIntersect: boolean): T[] {\n const result = [];\n let i = 0;\n let j = 0;\n while (i < array1.length && j < array2.length) {\n const compareValue = comparator(array1[i], array2[j]);\n if (mergeNotIntersect || !compareValue) {\n result.push(compareValue <= 0 ? array1[i] : array2[j]);\n }\n if (compareValue <= 0) {\n i++;\n }\n if (compareValue >= 0) {\n j++;\n }\n }\n if (mergeNotIntersect) {\n while (i < array1.length) {\n result.push(array1[i++]);\n }\n while (j < array2.length) {\n result.push(array2[j++]);\n }\n }\n return result;\n}\n\nexport const intersectOrdered = <T>(array1: T[], array2: T[], comparator: (a: T, b: T) => number): T[] => {\n return mergeOrIntersect(array1, array2, comparator, false);\n};\n\nexport const mergeOrdered = <T>(array1: T[], array2: T[], comparator: (a: T, b: T) => number): T[] => {\n return mergeOrIntersect(array1, array2, comparator, true);\n};\n\nexport const DEFAULT_COMPARATOR = (a: string|number, b: string|number): -1|0|1 => {\n return a < b ? -1 : (a > b ? 1 : 0);\n};\n\n/**\n * Returns the index of the element closest to the needle that is equal to or\n * greater than it. Assumes that the provided array is sorted.\n *\n * If no element is found, the right bound is returned.\n *\n * Uses the provided comparator function to determine if two items are equal or\n * if one is greater than the other. If you are working with strings or\n * numbers, you can use ArrayUtilities.DEFAULT_COMPARATOR. Otherwise, you\n * should define one that takes the needle element and an element from the\n * array and returns a positive or negative number to indicate which is greater\n * than the other.\n *\n * When specified, |left| (inclusive) and |right| (exclusive) indices\n * define the search window.\n */\nexport function lowerBound<T>(\n array: Uint32Array|Int32Array, needle: T, comparator: (needle: T, b: number) => number, left?: number,\n right?: number): number;\nexport function lowerBound<S, T>(\n array: S[], needle: T, comparator: (needle: T, b: S) => number, left?: number, right?: number): number;\nexport function lowerBound<S, T>(\n array: readonly S[], needle: T, comparator: (needle: T, b: S) => number, left?: number, right?: number): number;\nexport function lowerBound<S, T, A extends S[]>(\n array: A, needle: T, comparator: (needle: T, b: S) => number, left?: number, right?: number): number {\n let l = left || 0;\n let r = right !== undefined ? right : array.length;\n while (l < r) {\n const m = (l + r) >> 1;\n if (comparator(needle, array[m]) > 0) {\n l = m + 1;\n } else {\n r = m;\n }\n }\n return r;\n}\n\n/**\n * Returns the index of the element closest to the needle that is greater than\n * it. Assumes that the provided array is sorted.\n *\n * If no element is found, the right bound is returned.\n *\n * Uses the provided comparator function to determine if two items are equal or\n * if one is greater than the other. If you are working with strings or\n * numbers, you can use ArrayUtilities.DEFAULT_COMPARATOR. Otherwise, you\n * should define one that takes the needle element and an element from the\n * array and returns a positive or negative number to indicate which is greater\n * than the other.\n *\n * When specified, |left| (inclusive) and |right| (exclusive) indices\n * define the search window.\n */\nexport function upperBound<T>(\n array: Uint32Array, needle: T, comparator: (needle: T, b: number) => number, left?: number, right?: number): number;\nexport function upperBound<S, T>(\n array: S[], needle: T, comparator: (needle: T, b: S) => number, left?: number, right?: number): number;\nexport function upperBound<S, T, A extends S[]>(\n array: A, needle: T, comparator: (needle: T, b: S) => number, left?: number, right?: number): number {\n let l = left || 0;\n let r = right !== undefined ? right : array.length;\n while (l < r) {\n const m = (l + r) >> 1;\n if (comparator(needle, array[m]) >= 0) {\n l = m + 1;\n } else {\n r = m;\n }\n }\n return r;\n}\n\nconst enum NearestSearchStart {\n BEGINNING = 'BEGINNING',\n END = 'END',\n}\n/**\n * Obtains the first or last item in the array that satisfies the predicate function.\n * So, for example, if the array were arr = [2, 4, 6, 8, 10], and you are looking for\n * the last item arr[i] such that arr[i] < 5 you would be returned 1, because\n * array[1] is 4, the last item in the array that satisfies the\n * predicate function.\n *\n * If instead you were looking for the first item in the same array that satisfies\n * arr[i] > 5 you would be returned 2 because array[2] = 6.\n *\n * Please note: this presupposes that the array is already ordered.\n */\nfunction nearestIndex<T>(\n arr: readonly T[], predicate: (arrayItem: T) => boolean, searchStart: NearestSearchStart): number|null {\n const searchFromEnd = searchStart === NearestSearchStart.END;\n if (arr.length === 0) {\n return null;\n }\n\n let left = 0;\n let right = arr.length - 1;\n let pivot = 0;\n let matchesPredicate = false;\n let moveToTheRight = false;\n let middle = 0;\n do {\n middle = left + (right - left) / 2;\n pivot = searchFromEnd ? Math.ceil(middle) : Math.floor(middle);\n matchesPredicate = predicate(arr[pivot]);\n moveToTheRight = matchesPredicate === searchFromEnd;\n if (moveToTheRight) {\n left = Math.min(right, pivot + (left === pivot ? 1 : 0));\n } else {\n right = Math.max(left, pivot + (right === pivot ? -1 : 0));\n }\n } while (right !== left);\n\n // Special-case: the indexed item doesn't pass the predicate. This\n // occurs when none of the items in the array are a match for the\n // predicate.\n if (!predicate(arr[left])) {\n return null;\n }\n return left;\n}\n\n/**\n * Obtains the first item in the array that satisfies the predicate function.\n * So, for example, if the array was arr = [2, 4, 6, 8, 10], and you are looking for\n * the first item arr[i] such that arr[i] > 5 you would be returned 2, because\n * array[2] is 6, the first item in the array that satisfies the\n * predicate function.\n *\n * Please note: this presupposes that the array is already ordered.\n */\nexport function nearestIndexFromBeginning<T>(arr: T[], predicate: (arrayItem: T) => boolean): number|null {\n return nearestIndex(arr, predicate, NearestSearchStart.BEGINNING);\n}\n\n/**\n * Obtains the last item in the array that satisfies the predicate function.\n * So, for example, if the array was arr = [2, 4, 6, 8, 10], and you are looking for\n * the last item arr[i] such that arr[i] < 5 you would be returned 1, because\n * arr[1] is 4, the last item in the array that satisfies the\n * predicate function.\n *\n * Please note: this presupposes that the array is already ordered.\n */\n\nexport function nearestIndexFromEnd<T>(arr: readonly T[], predicate: (arrayItem: T) => boolean): number|null {\n return nearestIndex(arr, predicate, NearestSearchStart.END);\n}\n\n// Type guard for ensuring that `arr` does not contain null or undefined\nexport function arrayDoesNotContainNullOrUndefined<T>(arr: (T|null|undefined)[]): arr is T[] {\n return !arr.includes(null) && !arr.includes(undefined);\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2020 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
export const isValid = (date) => {
|
|
5
|
-
return !isNaN(date.getTime());
|
|
6
|
-
};
|
|
7
|
-
export const toISO8601Compact = (date) => {
|
|
8
|
-
function leadZero(x) {
|
|
9
|
-
return (x > 9 ? '' : '0') + x;
|
|
10
|
-
}
|
|
11
|
-
return date.getFullYear() + leadZero(date.getMonth() + 1) + leadZero(date.getDate()) + 'T' +
|
|
12
|
-
leadZero(date.getHours()) + leadZero(date.getMinutes()) + leadZero(date.getSeconds());
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=date-utilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/date-utilities.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,6BAA6B;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAU,EAAW,EAAE;IAC7C,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAAU,EAAE;IACrD,SAAS,QAAQ,CAAC,CAAS;QACzB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,GAAG;QACtF,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;AAC5F,CAAC,CAAC","sourcesContent":["// Copyright (c) 2020 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport const isValid = (date: Date): boolean => {\n return !isNaN(date.getTime());\n};\n\nexport const toISO8601Compact = (date: Date): string => {\n function leadZero(x: number): string {\n return (x > 9 ? '' : '0') + x;\n }\n return date.getFullYear() + leadZero(date.getMonth() + 1) + leadZero(date.getDate()) + 'T' +\n leadZero(date.getHours()) + leadZero(date.getMinutes()) + leadZero(date.getSeconds());\n};\n"]}
|
package/core/platform/dcheck.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `document.activeElement` will not enter shadow roots to find the element
|
|
3
|
-
* that has focus; use this method if you need to traverse through any shadow
|
|
4
|
-
* roots to find the actual, specific focused element.
|
|
5
|
-
*/
|
|
6
|
-
export declare function deepActiveElement(doc: Document): Element | null;
|
|
7
|
-
export declare function getEnclosingShadowRootForNode(node: Node): Node | null;
|
|
8
|
-
export declare function rangeOfWord(rootNode: Node, offset: number, stopCharacters: string, stayWithinNode: Node, direction?: string): Range;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
// Copyright 2022 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
/**
|
|
5
|
-
* `document.activeElement` will not enter shadow roots to find the element
|
|
6
|
-
* that has focus; use this method if you need to traverse through any shadow
|
|
7
|
-
* roots to find the actual, specific focused element.
|
|
8
|
-
*/
|
|
9
|
-
export function deepActiveElement(doc) {
|
|
10
|
-
let activeElement = doc.activeElement;
|
|
11
|
-
while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) {
|
|
12
|
-
activeElement = activeElement.shadowRoot.activeElement;
|
|
13
|
-
}
|
|
14
|
-
return activeElement;
|
|
15
|
-
}
|
|
16
|
-
export function getEnclosingShadowRootForNode(node) {
|
|
17
|
-
let parentNode = node.parentNodeOrShadowHost();
|
|
18
|
-
while (parentNode) {
|
|
19
|
-
if (parentNode instanceof ShadowRoot) {
|
|
20
|
-
return parentNode;
|
|
21
|
-
}
|
|
22
|
-
parentNode = parentNode.parentNodeOrShadowHost();
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
export function rangeOfWord(rootNode, offset, stopCharacters, stayWithinNode, direction) {
|
|
27
|
-
let startNode;
|
|
28
|
-
let startOffset = 0;
|
|
29
|
-
let endNode;
|
|
30
|
-
let endOffset = 0;
|
|
31
|
-
if (!stayWithinNode) {
|
|
32
|
-
stayWithinNode = rootNode;
|
|
33
|
-
}
|
|
34
|
-
if (!direction || direction === 'backward' || direction === 'both') {
|
|
35
|
-
let node = rootNode;
|
|
36
|
-
while (node) {
|
|
37
|
-
if (node === stayWithinNode) {
|
|
38
|
-
if (!startNode) {
|
|
39
|
-
startNode = stayWithinNode;
|
|
40
|
-
}
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
if (node.nodeType === Node.TEXT_NODE && node.nodeValue !== null) {
|
|
44
|
-
const start = (node === rootNode ? (offset - 1) : (node.nodeValue.length - 1));
|
|
45
|
-
for (let i = start; i >= 0; --i) {
|
|
46
|
-
if (stopCharacters.indexOf(node.nodeValue[i]) !== -1) {
|
|
47
|
-
startNode = node;
|
|
48
|
-
startOffset = i + 1;
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (startNode) {
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
node = node.traversePreviousNode(stayWithinNode);
|
|
57
|
-
}
|
|
58
|
-
if (!startNode) {
|
|
59
|
-
startNode = stayWithinNode;
|
|
60
|
-
startOffset = 0;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
startNode = rootNode;
|
|
65
|
-
startOffset = offset;
|
|
66
|
-
}
|
|
67
|
-
if (!direction || direction === 'forward' || direction === 'both') {
|
|
68
|
-
let node = rootNode;
|
|
69
|
-
while (node) {
|
|
70
|
-
if (node === stayWithinNode) {
|
|
71
|
-
if (!endNode) {
|
|
72
|
-
endNode = stayWithinNode;
|
|
73
|
-
}
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
if (node.nodeType === Node.TEXT_NODE && node.nodeValue !== null) {
|
|
77
|
-
const start = (node === rootNode ? offset : 0);
|
|
78
|
-
for (let i = start; i < node.nodeValue.length; ++i) {
|
|
79
|
-
if (stopCharacters.indexOf(node.nodeValue[i]) !== -1) {
|
|
80
|
-
endNode = node;
|
|
81
|
-
endOffset = i;
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (endNode) {
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
node = node.traverseNextNode(stayWithinNode);
|
|
90
|
-
}
|
|
91
|
-
if (!endNode) {
|
|
92
|
-
endNode = stayWithinNode;
|
|
93
|
-
endOffset = stayWithinNode.nodeType === Node.TEXT_NODE ? stayWithinNode.nodeValue?.length || 0 :
|
|
94
|
-
stayWithinNode.childNodes.length;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
endNode = rootNode;
|
|
99
|
-
endOffset = offset;
|
|
100
|
-
}
|
|
101
|
-
if (!rootNode.ownerDocument) {
|
|
102
|
-
throw new Error('No `ownerDocument` found for rootNode');
|
|
103
|
-
}
|
|
104
|
-
const result = rootNode.ownerDocument.createRange();
|
|
105
|
-
result.setStart(startNode, startOffset);
|
|
106
|
-
result.setEnd(endNode, endOffset);
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=dom-utilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dom-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/dom-utilities.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAa;IAC7C,IAAI,aAAa,GAAiB,GAAG,CAAC,aAAa,CAAC;IACpD,OAAO,aAAa,IAAI,aAAa,CAAC,UAAU,IAAI,aAAa,CAAC,UAAU,CAAC,aAAa,EAAE;QAC1F,aAAa,GAAG,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC;KACxD;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,IAAU;IACtD,IAAI,U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AgB,CAAC,cAAc,CAAC,CAAC;SAC9C;QAED,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,cAAc,CAAC;YACzB,SAAS,GAAG,cAAc,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;gBACvC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC;SAC3F;KACF;SAAM;QACL,OAAO,GAAG,QAAQ,CAAC;QACnB,SAAS,GAAG,MAAM,CAAC;KACpB;IAED,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;KAC1D;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;IACpD,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACxC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * `document.activeElement` will not enter shadow roots to find the element\n * that has focus; use this method if you need to traverse through any shadow\n * roots to find the actual, specific focused element.\n */\nexport function deepActiveElement(doc: Document): Element|null {\n let activeElement: Element|null = doc.activeElement;\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n return activeElement;\n}\n\nexport function getEnclosingShadowRootForNode(node: Node): Node|null {\n let parentNode = node.parentNodeOrShadowHost();\n while (parentNode) {\n if (parentNode instanceof ShadowRoot) {\n return parentNode;\n }\n parentNode = parentNode.parentNodeOrShadowHost();\n }\n return null;\n}\n\nexport function rangeOfWord(\n rootNode: Node, offset: number, stopCharacters: string, stayWithinNode: Node, direction?: string): Range {\n let startNode;\n let startOffset = 0;\n let endNode;\n let endOffset = 0;\n\n if (!stayWithinNode) {\n stayWithinNode = rootNode;\n }\n\n if (!direction || direction === 'backward' || direction === 'both') {\n let node: Node|null = rootNode;\n while (node) {\n if (node === stayWithinNode) {\n if (!startNode) {\n startNode = stayWithinNode;\n }\n break;\n }\n\n if (node.nodeType === Node.TEXT_NODE && node.nodeValue !== null) {\n const start = (node === rootNode ? (offset - 1) : (node.nodeValue.length - 1));\n for (let i = start; i >= 0; --i) {\n if (stopCharacters.indexOf(node.nodeValue[i]) !== -1) {\n startNode = node;\n startOffset = i + 1;\n break;\n }\n }\n }\n\n if (startNode) {\n break;\n }\n\n node = node.traversePreviousNode(stayWithinNode);\n }\n\n if (!startNode) {\n startNode = stayWithinNode;\n startOffset = 0;\n }\n } else {\n startNode = rootNode;\n startOffset = offset;\n }\n\n if (!direction || direction === 'forward' || direction === 'both') {\n let node: (Node|null)|Node = rootNode;\n while (node) {\n if (node === stayWithinNode) {\n if (!endNode) {\n endNode = stayWithinNode;\n }\n break;\n }\n\n if (node.nodeType === Node.TEXT_NODE && node.nodeValue !== null) {\n const start = (node === rootNode ? offset : 0);\n for (let i = start; i < node.nodeValue.length; ++i) {\n if (stopCharacters.indexOf(node.nodeValue[i]) !== -1) {\n endNode = node;\n endOffset = i;\n break;\n }\n }\n }\n\n if (endNode) {\n break;\n }\n\n node = node.traverseNextNode(stayWithinNode);\n }\n\n if (!endNode) {\n endNode = stayWithinNode;\n endOffset = stayWithinNode.nodeType === Node.TEXT_NODE ? stayWithinNode.nodeValue?.length || 0 :\n stayWithinNode.childNodes.length;\n }\n } else {\n endNode = rootNode;\n endOffset = offset;\n }\n\n if (!rootNode.ownerDocument) {\n throw new Error('No `ownerDocument` found for rootNode');\n }\n const result = rootNode.ownerDocument.createRange();\n result.setStart(startNode, startOffset);\n result.setEnd(endNode, endOffset);\n\n return result;\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const enum ArrowKey {
|
|
2
|
-
UP = "ArrowUp",
|
|
3
|
-
DOWN = "ArrowDown",
|
|
4
|
-
LEFT = "ArrowLeft",
|
|
5
|
-
RIGHT = "ArrowRight"
|
|
6
|
-
}
|
|
7
|
-
export declare const enum PageKey {
|
|
8
|
-
UP = "PageUp",
|
|
9
|
-
DOWN = "PageDown"
|
|
10
|
-
}
|
|
11
|
-
export declare const ENTER_KEY = "Enter";
|
|
12
|
-
export declare const ESCAPE_KEY = "Escape";
|
|
13
|
-
export declare const TAB_KEY = "Tab";
|
|
14
|
-
export declare const ARROW_KEYS: Set<ArrowKey>;
|
|
15
|
-
export declare function keyIsArrowKey(key: string): key is ArrowKey;
|
|
16
|
-
export declare function isEscKey(event: KeyboardEvent): boolean;
|
|
17
|
-
export declare function isEnterOrSpaceKey(event: KeyboardEvent): boolean;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2020 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
export const ENTER_KEY = 'Enter';
|
|
5
|
-
export const ESCAPE_KEY = 'Escape';
|
|
6
|
-
export const TAB_KEY = 'Tab';
|
|
7
|
-
export const ARROW_KEYS = new Set([
|
|
8
|
-
"ArrowUp" /* ArrowKey.UP */,
|
|
9
|
-
"ArrowDown" /* ArrowKey.DOWN */,
|
|
10
|
-
"ArrowLeft" /* ArrowKey.LEFT */,
|
|
11
|
-
"ArrowRight" /* ArrowKey.RIGHT */,
|
|
12
|
-
]);
|
|
13
|
-
export function keyIsArrowKey(key) {
|
|
14
|
-
return ARROW_KEYS.has(key);
|
|
15
|
-
}
|
|
16
|
-
export function isEscKey(event) {
|
|
17
|
-
return event.key === 'Escape';
|
|
18
|
-
}
|
|
19
|
-
export function isEnterOrSpaceKey(event) {
|
|
20
|
-
return event.key === 'Enter' || event.key === ' ';
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=keyboard-utilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/keyboard-utilities.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,6BAA6B;AAc7B,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;AACjC,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;AACnC,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC;AAE7B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAW;;;;;CAK3C,CAAC,CAAC;AAEH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,UAAU,CAAC,GAAG,CAAC,GAAe,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAoB;IACpD,OAAO,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) 2020 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport const enum ArrowKey {\n UP = 'ArrowUp',\n DOWN = 'ArrowDown',\n LEFT = 'ArrowLeft',\n RIGHT = 'ArrowRight',\n}\n\nexport const enum PageKey {\n UP = 'PageUp',\n DOWN = 'PageDown',\n}\n\nexport const ENTER_KEY = 'Enter';\nexport const ESCAPE_KEY = 'Escape';\nexport const TAB_KEY = 'Tab';\n\nexport const ARROW_KEYS = new Set<ArrowKey>([\n ArrowKey.UP,\n ArrowKey.DOWN,\n ArrowKey.LEFT,\n ArrowKey.RIGHT,\n]);\n\nexport function keyIsArrowKey(key: string): key is ArrowKey {\n return ARROW_KEYS.has(key as ArrowKey);\n}\n\nexport function isEscKey(event: KeyboardEvent): boolean {\n return event.key === 'Escape';\n}\n\nexport function isEnterOrSpaceKey(event: KeyboardEvent): boolean {\n return event.key === 'Enter' || event.key === ' ';\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const inverse: <K, V>(map: Map<K, V>) => Multimap<V, K>;
|
|
2
|
-
export declare class Multimap<K, V> {
|
|
3
|
-
private map;
|
|
4
|
-
set(key: K, value: V): void;
|
|
5
|
-
get(key: K): Set<V>;
|
|
6
|
-
has(key: K): boolean;
|
|
7
|
-
hasValue(key: K, value: V): boolean;
|
|
8
|
-
get size(): number;
|
|
9
|
-
delete(key: K, value: V): boolean;
|
|
10
|
-
deleteAll(key: K): void;
|
|
11
|
-
keysArray(): K[];
|
|
12
|
-
valuesArray(): V[];
|
|
13
|
-
clear(): void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Gets value for key, assigning a default if value is falsy.
|
|
17
|
-
*/
|
|
18
|
-
export declare function getWithDefault<K extends {}, V>(map: WeakMap<K, V> | Map<K, V>, key: K, defaultValueFactory: (key?: K) => V): V;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2020 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
export const inverse = function (map) {
|
|
5
|
-
const result = new Multimap();
|
|
6
|
-
for (const [key, value] of map.entries()) {
|
|
7
|
-
result.set(value, key);
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
};
|
|
11
|
-
export class Multimap {
|
|
12
|
-
map = new Map();
|
|
13
|
-
set(key, value) {
|
|
14
|
-
let set = this.map.get(key);
|
|
15
|
-
if (!set) {
|
|
16
|
-
set = new Set();
|
|
17
|
-
this.map.set(key, set);
|
|
18
|
-
}
|
|
19
|
-
set.add(value);
|
|
20
|
-
}
|
|
21
|
-
get(key) {
|
|
22
|
-
return this.map.get(key) || new Set();
|
|
23
|
-
}
|
|
24
|
-
has(key) {
|
|
25
|
-
return this.map.has(key);
|
|
26
|
-
}
|
|
27
|
-
hasValue(key, value) {
|
|
28
|
-
const set = this.map.get(key);
|
|
29
|
-
if (!set) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
return set.has(value);
|
|
33
|
-
}
|
|
34
|
-
get size() {
|
|
35
|
-
return this.map.size;
|
|
36
|
-
}
|
|
37
|
-
delete(key, value) {
|
|
38
|
-
const values = this.get(key);
|
|
39
|
-
if (!values) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const result = values.delete(value);
|
|
43
|
-
if (!values.size) {
|
|
44
|
-
this.map.delete(key);
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
deleteAll(key) {
|
|
49
|
-
this.map.delete(key);
|
|
50
|
-
}
|
|
51
|
-
keysArray() {
|
|
52
|
-
return [...this.map.keys()];
|
|
53
|
-
}
|
|
54
|
-
valuesArray() {
|
|
55
|
-
const result = [];
|
|
56
|
-
for (const set of this.map.values()) {
|
|
57
|
-
result.push(...set.values());
|
|
58
|
-
}
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
clear() {
|
|
62
|
-
this.map.clear();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Gets value for key, assigning a default if value is falsy.
|
|
67
|
-
*/
|
|
68
|
-
export function getWithDefault(map, key, defaultValueFactory) {
|
|
69
|
-
let value = map.get(key);
|
|
70
|
-
if (!value) {
|
|
71
|
-
value = defaultValueFactory(key);
|
|
72
|
-
map.set(key, value);
|
|
73
|
-
}
|
|
74
|
-
return value;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=map-utilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map-utilities.js","sourceRoot":"","sources":["../../../../../../front_end/core/platform/map-utilities.ts"],"names":[],"mappings":"AAAA,g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c) 2020 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport const inverse = function<K, V>(map: Map<K, V>): Multimap<V, K> {\n const result = new Multimap<V, K>();\n for (const [key, value] of map.entries()) {\n result.set(value, key);\n }\n return result;\n};\n\nexport class Multimap<K, V> {\n private map = new Map<K, Set<V>>();\n\n set(key: K, value: V): void {\n let set = this.map.get(key);\n if (!set) {\n set = new Set();\n this.map.set(key, set);\n }\n set.add(value);\n }\n\n get(key: K): Set<V> {\n return this.map.get(key) || new Set();\n }\n\n has(key: K): boolean {\n return this.map.has(key);\n }\n\n hasValue(key: K, value: V): boolean {\n const set = this.map.get(key);\n if (!set) {\n return false;\n }\n return set.has(value);\n }\n\n get size(): number {\n return this.map.size;\n }\n\n delete(key: K, value: V): boolean {\n const values = this.get(key);\n if (!values) {\n return false;\n }\n const result = values.delete(value);\n if (!values.size) {\n this.map.delete(key);\n }\n return result;\n }\n\n deleteAll(key: K): void {\n this.map.delete(key);\n }\n\n keysArray(): K[] {\n return [...this.map.keys()];\n }\n\n valuesArray(): V[] {\n const result = [];\n for (const set of this.map.values()) {\n result.push(...set.values());\n }\n return result;\n }\n\n clear(): void {\n this.map.clear();\n }\n}\n\n/**\n * Gets value for key, assigning a default if value is falsy.\n */\nexport function getWithDefault<K extends {}, V>(\n map: WeakMap<K, V>|Map<K, V>, key: K, defaultValueFactory: (key?: K) => V): V {\n let value = map.get(key);\n if (!value) {\n value = defaultValueFactory(key);\n map.set(key, value);\n }\n\n return value;\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const clamp: (num: number, min: number, max: number) => number;
|
|
2
|
-
export declare const mod: (m: number, n: number) => number;
|
|
3
|
-
export declare const bytesToString: (bytes: number) => string;
|
|
4
|
-
export declare const toFixedIfFloating: (value: string) => string;
|
|
5
|
-
/**
|
|
6
|
-
* Rounds a number (including float) down.
|
|
7
|
-
*/
|
|
8
|
-
export declare const floor: (value: number, precision?: number) => number;
|
|
9
|
-
/**
|
|
10
|
-
* Computes the great common divisor for two numbers.
|
|
11
|
-
* If the numbers are floats, they will be rounded to an integer.
|
|
12
|
-
*/
|
|
13
|
-
export declare const greatestCommonDivisor: (a: number, b: number) => number;
|
|
14
|
-
export declare const aspectRatio: (width: number, height: number) => string;
|
|
15
|
-
export declare const withThousandsSeparator: (num: number) => string;
|