chrome-devtools-frontend 1.0.927127 → 1.0.927419
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/config/gni/devtools_grd_files.gni +3 -0
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/i18n/locales/en-US.json +27 -9
- package/front_end/core/i18n/locales/en-XL.json +27 -9
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/entrypoints/main/MainImpl.ts +0 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/sources-meta.ts +22 -7
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
- package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
- package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
- package/front_end/ui/components/docs/text_editor/basic.html +28 -0
- package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
- package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
- package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
- package/front_end/ui/components/text_editor/config.ts +264 -0
- package/front_end/ui/components/text_editor/text_editor.ts +6 -0
- package/front_end/ui/components/text_editor/theme.ts +113 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
- package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
- package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +7 -8
- package/front_end/ui/legacy/filter.css +1 -0
- package/inspector_overlay/main.ts +2 -1
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import * as i18n from '../../../../core/i18n/i18n.js';
|
|
|
10
10
|
import * as Platform from '../../../../core/platform/platform.js';
|
|
11
11
|
import * as TextUtils from '../../../../models/text_utils/text_utils.js';
|
|
12
12
|
import * as Diff from '../../../../third_party/diff/diff.js';
|
|
13
|
+
import * as TextPrompt from '../../../../ui/components/text_prompt/text_prompt.js';
|
|
13
14
|
import * as UI from '../../legacy.js';
|
|
14
15
|
|
|
15
16
|
const UIStrings = {
|
|
@@ -37,9 +38,8 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
37
38
|
private loadTimeout: number;
|
|
38
39
|
private refreshListWithCurrentResult!: (() => void)|undefined;
|
|
39
40
|
private dialog!: UI.Dialog.Dialog|undefined;
|
|
40
|
-
private query
|
|
41
|
-
private readonly
|
|
42
|
-
private readonly prompt: UI.TextPrompt.TextPrompt;
|
|
41
|
+
private query = '';
|
|
42
|
+
private readonly inputBoxElement: TextPrompt.TextPrompt.TextPrompt;
|
|
43
43
|
private readonly hintElement: HTMLElement;
|
|
44
44
|
private readonly bottomElementsContainer: HTMLElement;
|
|
45
45
|
private readonly progressElement: HTMLElement;
|
|
@@ -48,7 +48,7 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
48
48
|
private list: UI.ListControl.ListControl<number>;
|
|
49
49
|
private readonly itemElementsContainer: HTMLDivElement;
|
|
50
50
|
private notFoundElement: HTMLElement;
|
|
51
|
-
private prefix
|
|
51
|
+
private prefix = '';
|
|
52
52
|
private provider: Provider|null;
|
|
53
53
|
private readonly queryChangedCallback?: (arg0: string) => void;
|
|
54
54
|
|
|
@@ -66,15 +66,11 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
66
66
|
UI.ARIAUtils.markAsCombobox(this.contentElement);
|
|
67
67
|
this.registerRequiredCSS('ui/legacy/components/quick_open/filteredListWidget.css');
|
|
68
68
|
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
this.
|
|
72
|
-
|
|
73
|
-
this.
|
|
74
|
-
this.prompt.initialize(() => Promise.resolve([]));
|
|
75
|
-
const promptProxy = this.prompt.attach(this.promptElement);
|
|
76
|
-
promptProxy.addEventListener('input', this.onInput.bind(this), false);
|
|
77
|
-
promptProxy.classList.add('filtered-list-widget-prompt-element');
|
|
69
|
+
this.inputBoxElement = new TextPrompt.TextPrompt.TextPrompt();
|
|
70
|
+
this.inputBoxElement.data = {ariaLabel: i18nString(UIStrings.quickOpenPrompt), prefix: '', suggestion: ''};
|
|
71
|
+
this.inputBoxElement.addEventListener(
|
|
72
|
+
TextPrompt.TextPrompt.PromptInputEvent.eventName, this.onInput.bind(this), false);
|
|
73
|
+
this.contentElement.appendChild(this.inputBoxElement);
|
|
78
74
|
|
|
79
75
|
this.hintElement = this.contentElement.createChild('div', 'filtered-list-widget-hint');
|
|
80
76
|
|
|
@@ -89,15 +85,14 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
89
85
|
this.bottomElementsContainer.appendChild(this.itemElementsContainer);
|
|
90
86
|
this.itemElementsContainer.addEventListener('click', this.onClick.bind(this), false);
|
|
91
87
|
UI.ARIAUtils.markAsListBox(this.itemElementsContainer);
|
|
92
|
-
UI.ARIAUtils.setControls(this.
|
|
93
|
-
UI.ARIAUtils.setAutocomplete(this.
|
|
88
|
+
UI.ARIAUtils.setControls(this.inputBoxElement, this.itemElementsContainer);
|
|
89
|
+
UI.ARIAUtils.setAutocomplete(this.inputBoxElement, UI.ARIAUtils.AutocompleteInteractionModel.list);
|
|
94
90
|
|
|
95
91
|
this.notFoundElement = this.bottomElementsContainer.createChild('div', 'not-found-text');
|
|
96
92
|
this.notFoundElement.classList.add('hidden');
|
|
97
93
|
|
|
98
|
-
this.setDefaultFocusedElement(this.
|
|
94
|
+
this.setDefaultFocusedElement(this.inputBoxElement);
|
|
99
95
|
|
|
100
|
-
this.prefix = '';
|
|
101
96
|
this.provider = provider;
|
|
102
97
|
this.queryChangedCallback = queryChangedCallback;
|
|
103
98
|
}
|
|
@@ -138,6 +133,14 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
138
133
|
return false;
|
|
139
134
|
}
|
|
140
135
|
|
|
136
|
+
setCommandPrefix(commandPrefix: string): void {
|
|
137
|
+
this.inputBoxElement.setPrefix(commandPrefix);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
setCommandSuggestion(suggestion: string): void {
|
|
141
|
+
this.inputBoxElement.setSuggestion(suggestion);
|
|
142
|
+
}
|
|
143
|
+
|
|
141
144
|
setHintElement(hint: string): void {
|
|
142
145
|
this.hintElement.textContent = hint;
|
|
143
146
|
}
|
|
@@ -146,7 +149,7 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
146
149
|
* Sets the text prompt's accessible title. By default, it is "Quick open prompt".
|
|
147
150
|
*/
|
|
148
151
|
setPromptTitle(title: string): void {
|
|
149
|
-
UI.ARIAUtils.setAccessibleName(this.
|
|
152
|
+
UI.ARIAUtils.setAccessibleName(this.inputBoxElement, title);
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
showAsDialog(dialogTitle?: string): void {
|
|
@@ -190,7 +193,7 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
setQuerySelectedRange(startIndex: number, endIndex: number): void {
|
|
193
|
-
this.
|
|
196
|
+
this.inputBoxElement.setSelectedRange(startIndex, endIndex);
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
private attachProvider(): void {
|
|
@@ -203,12 +206,8 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
203
206
|
this.itemsLoaded(this.provider);
|
|
204
207
|
}
|
|
205
208
|
|
|
206
|
-
private value(): string {
|
|
207
|
-
return this.prompt.text().trim();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
209
|
private cleanValue(): string {
|
|
211
|
-
return this.
|
|
210
|
+
return this.query.substring(this.prefix.length);
|
|
212
211
|
}
|
|
213
212
|
|
|
214
213
|
wasShown(): void {
|
|
@@ -290,7 +289,7 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
290
289
|
if (toElement) {
|
|
291
290
|
toElement.classList.add('selected');
|
|
292
291
|
}
|
|
293
|
-
UI.ARIAUtils.setActiveDescendant(this.
|
|
292
|
+
UI.ARIAUtils.setActiveDescendant(this.inputBoxElement, toElement);
|
|
294
293
|
}
|
|
295
294
|
|
|
296
295
|
private onClick(event: Event): void {
|
|
@@ -307,15 +306,15 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
307
306
|
}
|
|
308
307
|
|
|
309
308
|
setQuery(query: string): void {
|
|
310
|
-
this.
|
|
311
|
-
this.
|
|
309
|
+
this.query = query;
|
|
310
|
+
this.inputBoxElement.focus();
|
|
311
|
+
this.inputBoxElement.setText(query);
|
|
312
312
|
this.queryChanged();
|
|
313
|
-
this.prompt.autoCompleteSoon(true);
|
|
314
313
|
this.scheduleFilter();
|
|
315
314
|
}
|
|
316
315
|
|
|
317
316
|
private tabKeyPressed(): boolean {
|
|
318
|
-
const userEnteredText = this.
|
|
317
|
+
const userEnteredText = this.query;
|
|
319
318
|
let completion;
|
|
320
319
|
for (let i = this.promptHistory.length - 1; i >= 0; i--) {
|
|
321
320
|
if (this.promptHistory[i] !== userEnteredText && this.promptHistory[i].startsWith(userEnteredText)) {
|
|
@@ -326,9 +325,9 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
326
325
|
if (!completion) {
|
|
327
326
|
return false;
|
|
328
327
|
}
|
|
329
|
-
this.
|
|
330
|
-
this.
|
|
331
|
-
this.
|
|
328
|
+
this.inputBoxElement.focus();
|
|
329
|
+
this.inputBoxElement.setText(completion);
|
|
330
|
+
this.inputBoxElement.setSelectedRange(userEnteredText.length, completion.length);
|
|
332
331
|
this.scheduleFilter();
|
|
333
332
|
return true;
|
|
334
333
|
}
|
|
@@ -360,7 +359,6 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
360
359
|
this.progressBarElement.classList.remove('filtered-widget-progress-fade', 'hidden');
|
|
361
360
|
|
|
362
361
|
const query = this.provider.rewriteQuery(this.cleanValue());
|
|
363
|
-
this.query = query;
|
|
364
362
|
|
|
365
363
|
const filterRegex = query ? Platform.StringUtilities.filterRegex(query) : null;
|
|
366
364
|
|
|
@@ -468,14 +466,15 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
468
466
|
}
|
|
469
467
|
}
|
|
470
468
|
|
|
471
|
-
private onInput(): void {
|
|
469
|
+
private onInput(event: TextPrompt.TextPrompt.PromptInputEvent): void {
|
|
470
|
+
this.query = event.data;
|
|
472
471
|
this.queryChanged();
|
|
473
472
|
this.scheduleFilter();
|
|
474
473
|
}
|
|
475
474
|
|
|
476
475
|
private async queryChanged(): Promise<void> {
|
|
477
476
|
if (this.queryChangedCallback) {
|
|
478
|
-
await this.queryChangedCallback(this.
|
|
477
|
+
await this.queryChangedCallback(this.query);
|
|
479
478
|
}
|
|
480
479
|
if (this.provider) {
|
|
481
480
|
this.provider.queryChanged(this.cleanValue());
|
|
@@ -521,7 +520,7 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
|
|
|
521
520
|
}
|
|
522
521
|
|
|
523
522
|
private selectItem(itemIndex: number|null): void {
|
|
524
|
-
this.promptHistory.push(this.
|
|
523
|
+
this.promptHistory.push(this.query);
|
|
525
524
|
if (this.promptHistory.length > 100) {
|
|
526
525
|
this.promptHistory.shift();
|
|
527
526
|
}
|
|
@@ -603,8 +602,9 @@ export function getRegisteredProviders(): ProviderRegistration[] {
|
|
|
603
602
|
return registeredProviders;
|
|
604
603
|
}
|
|
605
604
|
export interface ProviderRegistration {
|
|
606
|
-
provider: () => Promise<Provider>;
|
|
607
|
-
title?: (() => string);
|
|
608
605
|
prefix: string;
|
|
609
606
|
iconName: string;
|
|
607
|
+
provider: () => Promise<Provider>;
|
|
608
|
+
titlePrefix: (() => string);
|
|
609
|
+
titleSuggestion?: (() => string);
|
|
610
610
|
}
|
|
@@ -36,10 +36,15 @@ export class HelpQuickOpen extends Provider {
|
|
|
36
36
|
private addProvider(extension: {
|
|
37
37
|
prefix: string,
|
|
38
38
|
iconName: string,
|
|
39
|
-
|
|
39
|
+
titlePrefix: () => string,
|
|
40
|
+
titleSuggestion?: () => string,
|
|
40
41
|
}): void {
|
|
41
|
-
if (extension.
|
|
42
|
-
this.providers.push({
|
|
42
|
+
if (extension.titleSuggestion) {
|
|
43
|
+
this.providers.push({
|
|
44
|
+
prefix: extension.prefix || '',
|
|
45
|
+
iconName: extension.iconName,
|
|
46
|
+
title: extension.titlePrefix() + ' ' + extension.titleSuggestion(),
|
|
47
|
+
});
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
|
|
@@ -84,6 +89,7 @@ export class HelpQuickOpen extends Provider {
|
|
|
84
89
|
registerProvider({
|
|
85
90
|
prefix: '?',
|
|
86
91
|
iconName: 'ic_command_help',
|
|
87
|
-
title: undefined,
|
|
88
92
|
provider: () => Promise.resolve(HelpQuickOpen.instance()),
|
|
93
|
+
titlePrefix: () => 'Help',
|
|
94
|
+
titleSuggestion: undefined,
|
|
89
95
|
});
|
|
@@ -21,15 +21,18 @@ export const history: string[] = [];
|
|
|
21
21
|
|
|
22
22
|
export class QuickOpenImpl {
|
|
23
23
|
private prefix: string|null;
|
|
24
|
-
private readonly query: string;
|
|
25
|
-
private readonly providers: Map<string, () => Promise<Provider>>;
|
|
26
24
|
private readonly prefixes: string[];
|
|
25
|
+
private providers: Map<string, {
|
|
26
|
+
provider: () => Promise<Provider>,
|
|
27
|
+
titlePrefix: (() => string),
|
|
28
|
+
titleSuggestion?: (() => string),
|
|
29
|
+
}>;
|
|
27
30
|
private filteredListWidget: FilteredListWidget|null;
|
|
31
|
+
|
|
28
32
|
constructor() {
|
|
29
33
|
this.prefix = null;
|
|
30
|
-
this.query = '';
|
|
31
|
-
this.providers = new Map();
|
|
32
34
|
this.prefixes = [];
|
|
35
|
+
this.providers = new Map();
|
|
33
36
|
this.filteredListWidget = null;
|
|
34
37
|
|
|
35
38
|
getRegisteredProviders().forEach(this.addProvider.bind(this));
|
|
@@ -48,18 +51,27 @@ export class QuickOpenImpl {
|
|
|
48
51
|
private addProvider(extension: {
|
|
49
52
|
prefix: string,
|
|
50
53
|
provider: () => Promise<Provider>,
|
|
54
|
+
titlePrefix: () => string,
|
|
55
|
+
titleSuggestion?: (() => string),
|
|
51
56
|
}): void {
|
|
52
57
|
const prefix = extension.prefix;
|
|
53
58
|
if (prefix === null) {
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
61
|
this.prefixes.push(prefix);
|
|
57
|
-
this.providers.set(prefix,
|
|
62
|
+
this.providers.set(prefix, {
|
|
63
|
+
provider: extension.provider,
|
|
64
|
+
titlePrefix: extension.titlePrefix,
|
|
65
|
+
titleSuggestion: extension.titleSuggestion,
|
|
66
|
+
});
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
private async queryChanged(query: string): Promise<void> {
|
|
61
70
|
const prefix = this.prefixes.find(prefix => query.startsWith(prefix));
|
|
62
71
|
if (typeof prefix !== 'string' || this.prefix === prefix) {
|
|
72
|
+
if (query !== prefix && this.filteredListWidget) {
|
|
73
|
+
this.filteredListWidget.setCommandSuggestion('');
|
|
74
|
+
}
|
|
63
75
|
return;
|
|
64
76
|
}
|
|
65
77
|
|
|
@@ -68,8 +80,13 @@ export class QuickOpenImpl {
|
|
|
68
80
|
return;
|
|
69
81
|
}
|
|
70
82
|
this.filteredListWidget.setPrefix(prefix);
|
|
83
|
+
const titlePrefixFunction = this.providers.get(prefix)?.titlePrefix;
|
|
84
|
+
this.filteredListWidget.setCommandPrefix(titlePrefixFunction ? titlePrefixFunction() : '');
|
|
85
|
+
const titleSuggestionFunction = this.providers.get(prefix)?.titleSuggestion;
|
|
86
|
+
this.filteredListWidget.setCommandSuggestion(titleSuggestionFunction ? titleSuggestionFunction() : '');
|
|
87
|
+
|
|
71
88
|
this.filteredListWidget.setProvider(null);
|
|
72
|
-
const providerFunction = this.providers.get(prefix);
|
|
89
|
+
const providerFunction = this.providers.get(prefix)?.provider;
|
|
73
90
|
if (!providerFunction) {
|
|
74
91
|
return;
|
|
75
92
|
}
|
|
@@ -27,13 +27,12 @@
|
|
|
27
27
|
font-size: inherit;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
border: 1px solid transparent;
|
|
30
|
+
devtools-text-prompt {
|
|
31
|
+
flex: 0 0 40px;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
font-family: '.SFNSDisplay-Regular', 'Helvetica Neue', 'Lucida Grande', sans-serif;
|
|
34
|
+
line-height: 16px;
|
|
35
|
+
padding: 12px;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
.filtered-list-widget-hint {
|
|
@@ -246,7 +245,7 @@
|
|
|
246
245
|
color: HighlightText;
|
|
247
246
|
}
|
|
248
247
|
|
|
249
|
-
|
|
248
|
+
devtools-text-prompt {
|
|
250
249
|
border-color: ButtonText;
|
|
251
250
|
}
|
|
252
251
|
}
|
|
@@ -21,6 +21,7 @@ import {PersistentOverlay} from './tool_persistent.js';
|
|
|
21
21
|
// @ts-ignore Importing CSS is handled in Rollup.
|
|
22
22
|
import screenshotStyle from './tool_screenshot.css'; // eslint-disable-line rulesdir/es_modules_import
|
|
23
23
|
import {ScreenshotOverlay} from './tool_screenshot.js';
|
|
24
|
+
import type {ScreenshotToolMessage} from './tool_screenshot.js';
|
|
24
25
|
// @ts-ignore Importing CSS is handled in Rollup.
|
|
25
26
|
import sourceOrderStyle from './tool_source_order.css'; // eslint-disable-line rulesdir/es_modules_import
|
|
26
27
|
import {SourceOrderOverlay} from './tool_source_order.js';
|
|
@@ -30,7 +31,7 @@ declare global {
|
|
|
30
31
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
32
|
interface Window {
|
|
32
33
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
|
-
InspectorOverlayHost: {send(data: PausedToolMessage|PersistentToolMessage|string): void};
|
|
34
|
+
InspectorOverlayHost: {send(data: PausedToolMessage|PersistentToolMessage|ScreenshotToolMessage|string): void};
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import {Overlay} from './common.js';
|
|
6
6
|
|
|
7
|
+
export type ScreenshotToolMessage = {
|
|
8
|
+
x: number,
|
|
9
|
+
y: number,
|
|
10
|
+
width: number,
|
|
11
|
+
height: number,
|
|
12
|
+
};
|
|
13
|
+
|
|
7
14
|
let anchor: {x: number, y: number}|null = null;
|
|
8
15
|
let position: {x: number, y: number}|null = null;
|
|
9
16
|
|
|
@@ -56,7 +63,7 @@ export class ScreenshotOverlay extends Overlay {
|
|
|
56
63
|
if (anchor && position) {
|
|
57
64
|
const rect = currentRect();
|
|
58
65
|
if (rect.width >= 5 && rect.height >= 5) {
|
|
59
|
-
this.window.InspectorOverlayHost.send(
|
|
66
|
+
this.window.InspectorOverlayHost.send(rect);
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
cancel();
|
package/package.json
CHANGED