chrome-devtools-frontend 1.0.941208 → 1.0.942095
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/all_devtools_files.gni +0 -6
- package/config/gni/devtools_grd_files.gni +6 -12
- package/config/gni/devtools_image_files.gni +0 -2
- package/front_end/Tests.js +1 -0
- package/front_end/core/common/Color.ts +5 -0
- package/front_end/core/i18n/locales/en-US.json +16 -28
- package/front_end/core/i18n/locales/en-XL.json +16 -28
- package/front_end/core/sdk/sdk-meta.ts +17 -3
- package/front_end/entrypoints/devtools_app/devtools_app.json +1 -7
- package/front_end/entrypoints/main/MainImpl.ts +26 -0
- package/front_end/entrypoints/shell/shell.js +0 -11
- package/front_end/entrypoints/worker_app/worker_app.json +0 -4
- package/front_end/generated/InspectorBackendCommands.js +1 -0
- package/front_end/generated/protocol.d.ts +2 -0
- package/front_end/legacy_test_runner/legacy_test_runner.ts +10 -1
- package/front_end/models/formatter/SourceFormatter.ts +0 -10
- package/front_end/models/workspace/UISourceCode.ts +9 -42
- package/front_end/panels/animation/AnimationTimeline.ts +3 -3
- package/front_end/panels/application/ApplicationPanelSidebar.ts +3 -3
- package/front_end/panels/application/application-meta.ts +0 -3
- package/front_end/panels/console/ConsolePinPane.ts +21 -26
- package/front_end/panels/coverage/CoverageDecorationManager.ts +4 -5
- package/front_end/panels/coverage/CoverageView.ts +2 -105
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +11 -56
- package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -8
- package/front_end/panels/elements/ElementsTreeElement.ts +4 -9
- package/front_end/panels/elements/components/adornerSettingsPane.css +0 -4
- package/front_end/panels/emulation/emulation-meta.ts +2 -2
- package/front_end/panels/issues/issues-meta.ts +0 -2
- package/front_end/panels/layers/module.json +0 -1
- package/front_end/panels/lighthouse/lighthouseStartView.css +4 -0
- package/front_end/panels/media/media-meta.ts +0 -3
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -1
- package/front_end/panels/network/network-meta.ts +0 -3
- package/front_end/panels/security/security-meta.ts +0 -3
- package/front_end/panels/sources/BreakpointEditDialog.ts +16 -30
- package/front_end/panels/sources/CSSPlugin.ts +310 -331
- package/front_end/panels/sources/CallStackSidebarPane.ts +28 -34
- package/front_end/panels/sources/CoveragePlugin.ts +121 -6
- package/front_end/panels/sources/DebuggerPlugin.ts +1166 -1243
- package/front_end/panels/sources/EditingLocationHistoryManager.ts +71 -101
- package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -3
- package/front_end/panels/sources/InplaceFormatterEditorAction.ts +3 -3
- package/front_end/panels/sources/JavaScriptCompilerPlugin.ts +26 -23
- package/front_end/panels/sources/Plugin.ts +20 -4
- package/front_end/panels/sources/ProfilePlugin.ts +185 -0
- package/front_end/panels/sources/ScriptFormatterEditorAction.ts +3 -3
- package/front_end/panels/sources/ScriptOriginPlugin.ts +0 -10
- package/front_end/panels/sources/SnippetsPlugin.ts +1 -10
- package/front_end/panels/sources/SourcesPanel.ts +6 -5
- package/front_end/panels/sources/SourcesView.ts +10 -8
- package/front_end/panels/sources/TabbedEditorContainer.ts +31 -27
- package/front_end/panels/sources/UISourceCodeFrame.ts +335 -470
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -2
- package/front_end/panels/sources/sources-legacy.ts +0 -6
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/panels/timeline/module.json +0 -1
- package/front_end/third_party/codemirror.next/bundle.ts +9 -13
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/javascript.js +2 -2
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -6
- package/front_end/third_party/codemirror.next/chunk/php.js +2 -6
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js +2 -2
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +279 -198
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +13 -11
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +60 -68
- package/front_end/ui/components/data_grid/dataGrid.css +12 -10
- package/front_end/ui/components/docs/css_overview/start_view.html +25 -0
- package/front_end/ui/components/docs/css_overview/start_view.ts +14 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +79 -36
- package/front_end/ui/components/text_editor/config.ts +42 -26
- package/front_end/ui/components/text_editor/javascript.ts +2 -3
- package/front_end/ui/components/text_editor/position.ts +17 -0
- package/front_end/ui/components/text_editor/text_editor.ts +1 -0
- package/front_end/ui/components/text_editor/theme.ts +5 -1
- package/front_end/ui/legacy/Infobar.ts +2 -6
- package/front_end/ui/legacy/ShortcutRegistry.ts +11 -7
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +35 -131
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +3 -6
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +18 -14
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +502 -252
- package/front_end/ui/legacy/components/source_frame/source_frame-legacy.ts +0 -11
- package/front_end/ui/legacy/components/source_frame/source_frame.ts +0 -2
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +3 -1
- package/front_end/ui/legacy/radioButton.css +1 -13
- package/front_end/ui/legacy/themeColors.css +36 -0
- package/package.json +1 -1
- package/front_end/Images/radioDot-dark-theme.png +0 -0
- package/front_end/Images/radioDot.png +0 -0
- package/front_end/panels/application/module.json +0 -6
- package/front_end/panels/issues/module.json +0 -6
- package/front_end/panels/layer_viewer/module.json +0 -5
- package/front_end/panels/media/module.json +0 -5
- package/front_end/panels/network/module.json +0 -5
- package/front_end/panels/security/module.json +0 -5
- package/front_end/ui/legacy/components/source_frame/SourcesTextEditor.ts +0 -1030
|
@@ -60,7 +60,7 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
60
60
|
private nameInternal: string;
|
|
61
61
|
private contentTypeInternal: Common.ResourceType.ResourceType;
|
|
62
62
|
private requestContentPromise: Promise<TextUtils.ContentProvider.DeferredContent>|null;
|
|
63
|
-
private decorations:
|
|
63
|
+
private decorations: Map<string, any> = new Map();
|
|
64
64
|
private hasCommitsInternal: boolean;
|
|
65
65
|
private messagesInternal: Set<Message>|null;
|
|
66
66
|
private contentLoadedInternal: boolean;
|
|
@@ -94,7 +94,6 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
94
94
|
|
|
95
95
|
this.contentTypeInternal = contentType;
|
|
96
96
|
this.requestContentPromise = null;
|
|
97
|
-
this.decorations = null;
|
|
98
97
|
this.hasCommitsInternal = false;
|
|
99
98
|
this.messagesInternal = null;
|
|
100
99
|
this.contentLoadedInternal = false;
|
|
@@ -455,45 +454,15 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
455
454
|
this.messagesInternal = null;
|
|
456
455
|
}
|
|
457
456
|
|
|
458
|
-
|
|
459
|
-
this.
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
addDecoration(range: TextUtils.TextRange.TextRange, type: string, data: any): void {
|
|
463
|
-
const marker = new LineMarker(range, type, data);
|
|
464
|
-
if (!this.decorations) {
|
|
465
|
-
this.decorations = new Platform.MapUtilities.Multimap();
|
|
466
|
-
}
|
|
467
|
-
this.decorations.set(type, marker);
|
|
468
|
-
this.dispatchEventToListeners(Events.LineDecorationAdded, marker);
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
removeDecorationsForType(type: string): void {
|
|
472
|
-
if (!this.decorations) {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
const markers = this.decorations.get(type);
|
|
476
|
-
this.decorations.deleteAll(type);
|
|
477
|
-
markers.forEach(marker => {
|
|
478
|
-
this.dispatchEventToListeners(Events.LineDecorationRemoved, marker);
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
allDecorations(): LineMarker[] {
|
|
483
|
-
return this.decorations ? this.decorations.valuesArray() : [];
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
removeAllDecorations(): void {
|
|
487
|
-
if (!this.decorations) {
|
|
488
|
-
return;
|
|
457
|
+
setDecorationData(type: string, data: any): void {
|
|
458
|
+
if (data !== this.decorations.get(type)) {
|
|
459
|
+
this.decorations.set(type, data);
|
|
460
|
+
this.dispatchEventToListeners(Events.DecorationChanged, type);
|
|
489
461
|
}
|
|
490
|
-
const decorationList = this.decorations.valuesArray();
|
|
491
|
-
this.decorations.clear();
|
|
492
|
-
decorationList.forEach(marker => this.dispatchEventToListeners(Events.LineDecorationRemoved, marker));
|
|
493
462
|
}
|
|
494
463
|
|
|
495
|
-
|
|
496
|
-
return this.decorations
|
|
464
|
+
getDecorationData(type: string): any {
|
|
465
|
+
return this.decorations.get(type);
|
|
497
466
|
}
|
|
498
467
|
|
|
499
468
|
disableEdit(): void {
|
|
@@ -513,8 +482,7 @@ export enum Events {
|
|
|
513
482
|
TitleChanged = 'TitleChanged',
|
|
514
483
|
MessageAdded = 'MessageAdded',
|
|
515
484
|
MessageRemoved = 'MessageRemoved',
|
|
516
|
-
|
|
517
|
-
LineDecorationRemoved = 'LineDecorationRemoved',
|
|
485
|
+
DecorationChanged = 'DecorationChanged',
|
|
518
486
|
}
|
|
519
487
|
|
|
520
488
|
export interface WorkingCopyCommitedEvent {
|
|
@@ -529,8 +497,7 @@ export type EventTypes = {
|
|
|
529
497
|
[Events.TitleChanged]: UISourceCode,
|
|
530
498
|
[Events.MessageAdded]: Message,
|
|
531
499
|
[Events.MessageRemoved]: Message,
|
|
532
|
-
[Events.
|
|
533
|
-
[Events.LineDecorationRemoved]: LineMarker,
|
|
500
|
+
[Events.DecorationChanged]: string,
|
|
534
501
|
};
|
|
535
502
|
|
|
536
503
|
export class UILocation {
|
|
@@ -438,9 +438,6 @@ export class AnimationTimeline extends UI.Widget.VBox implements SDK.TargetManag
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
private togglePause(pause: boolean): void {
|
|
441
|
-
if (this.#scrubberPlayer) {
|
|
442
|
-
this.#scrubberPlayer.playbackRate = this.effectivePlaybackRate();
|
|
443
|
-
}
|
|
444
441
|
if (this.#selectedGroup) {
|
|
445
442
|
this.#selectedGroup.togglePause(pause);
|
|
446
443
|
const preview = this.#previewMap.get(this.#selectedGroup);
|
|
@@ -448,6 +445,9 @@ export class AnimationTimeline extends UI.Widget.VBox implements SDK.TargetManag
|
|
|
448
445
|
preview.element.classList.toggle('paused', pause);
|
|
449
446
|
}
|
|
450
447
|
}
|
|
448
|
+
if (this.#scrubberPlayer) {
|
|
449
|
+
this.#scrubberPlayer.playbackRate = this.effectivePlaybackRate();
|
|
450
|
+
}
|
|
451
451
|
this.updateControlButton();
|
|
452
452
|
}
|
|
453
453
|
|
|
@@ -1970,13 +1970,13 @@ export class FrameResourceTreeElement extends ApplicationPanelTreeElement {
|
|
|
1970
1970
|
contextMenu.show();
|
|
1971
1971
|
}
|
|
1972
1972
|
|
|
1973
|
-
async revealResource(
|
|
1973
|
+
async revealResource(lineNumber?: number, columnNumber?: number): Promise<void> {
|
|
1974
1974
|
this.revealAndSelect(true);
|
|
1975
1975
|
const view = await this.panel.scheduleShowView(this.preparePreview());
|
|
1976
|
-
if (!(view instanceof SourceFrame.ResourceSourceFrame.ResourceSourceFrame) || typeof
|
|
1976
|
+
if (!(view instanceof SourceFrame.ResourceSourceFrame.ResourceSourceFrame) || typeof lineNumber !== 'number') {
|
|
1977
1977
|
return;
|
|
1978
1978
|
}
|
|
1979
|
-
view.revealPosition(
|
|
1979
|
+
view.revealPosition({lineNumber, columnNumber}, true);
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
1982
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
|
-
import * as Root from '../../core/root/root.js';
|
|
7
6
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
7
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
9
8
|
|
|
@@ -47,8 +46,6 @@ let loadedResourcesModule: (typeof Resources|undefined);
|
|
|
47
46
|
|
|
48
47
|
async function loadResourcesModule(): Promise<typeof Resources> {
|
|
49
48
|
if (!loadedResourcesModule) {
|
|
50
|
-
// Side-effect import resources in module.json
|
|
51
|
-
await Root.Runtime.Runtime.instance().loadModulePromise('panels/application');
|
|
52
49
|
loadedResourcesModule = await import('./application.js');
|
|
53
50
|
}
|
|
54
51
|
return loadedResourcesModule;
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
7
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
|
+
import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
9
|
+
import * as TextEditor from '../../ui/components/text_editor/text_editor.js';
|
|
8
10
|
import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
|
|
9
11
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
10
12
|
import objectValueStyles from '../../ui/legacy/components/object_ui/objectValue.css.js';
|
|
11
|
-
import type * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
12
|
-
import type * as TextEditor from '../../ui/components/text_editor/text_editor.js';
|
|
13
13
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
14
14
|
|
|
15
15
|
import consolePinPaneStyles from './consolePinPane.css.js';
|
|
@@ -171,11 +171,10 @@ export class ConsolePin {
|
|
|
171
171
|
private readonly pinPreview: HTMLElement;
|
|
172
172
|
private lastResult: SDK.RuntimeModel.EvaluationResult|null;
|
|
173
173
|
private lastExecutionContext: SDK.RuntimeModel.ExecutionContext|null;
|
|
174
|
-
private editor: TextEditor.TextEditor.TextEditor
|
|
174
|
+
private editor: TextEditor.TextEditor.TextEditor;
|
|
175
175
|
private committedExpression: string;
|
|
176
176
|
private hovered: boolean;
|
|
177
177
|
private lastNode: SDK.RemoteObject.RemoteObject|null;
|
|
178
|
-
private readonly editorPromise: Promise<TextEditor.TextEditor.TextEditor>;
|
|
179
178
|
private consolePinNumber: number;
|
|
180
179
|
private deletePinIcon: UI.UIUtils.DevToolsCloseButton;
|
|
181
180
|
|
|
@@ -209,10 +208,10 @@ export class ConsolePin {
|
|
|
209
208
|
|
|
210
209
|
this.lastResult = null;
|
|
211
210
|
this.lastExecutionContext = null;
|
|
212
|
-
this.editor = null;
|
|
213
211
|
this.committedExpression = expression;
|
|
214
212
|
this.hovered = false;
|
|
215
213
|
this.lastNode = null;
|
|
214
|
+
this.editor = this.createEditor(expression, nameElement);
|
|
216
215
|
|
|
217
216
|
this.pinPreview.addEventListener('mouseenter', this.setHovered.bind(this, true), false);
|
|
218
217
|
this.pinPreview.addEventListener('mouseleave', this.setHovered.bind(this, false), false);
|
|
@@ -229,22 +228,19 @@ export class ConsolePin {
|
|
|
229
228
|
event.consume();
|
|
230
229
|
}
|
|
231
230
|
});
|
|
232
|
-
this.editorPromise = this.createEditor(expression, nameElement);
|
|
233
231
|
}
|
|
234
232
|
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
const TE = await import('../../ui/components/text_editor/text_editor.js');
|
|
238
|
-
this.editor = new TE.TextEditor.TextEditor(CM.EditorState.create({
|
|
233
|
+
createEditor(expression: string, parent: HTMLElement): TextEditor.TextEditor.TextEditor {
|
|
234
|
+
const editor = new TextEditor.TextEditor.TextEditor(CodeMirror.EditorState.create({
|
|
239
235
|
doc: expression,
|
|
240
236
|
extensions: [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
237
|
+
CodeMirror.EditorView.contentAttributes.of({'aria-label': i18nString(UIStrings.liveExpressionEditor)}),
|
|
238
|
+
CodeMirror.EditorView.lineWrapping,
|
|
239
|
+
CodeMirror.javascript.javascriptLanguage,
|
|
240
|
+
TextEditor.JavaScript.completion(),
|
|
241
|
+
TextEditor.Config.showCompletionHint,
|
|
242
|
+
CodeMirror.placeholder(i18nString(UIStrings.expression)),
|
|
243
|
+
CodeMirror.keymap.of([
|
|
248
244
|
{
|
|
249
245
|
key: 'Escape',
|
|
250
246
|
run: (view: CodeMirror.EditorView): boolean => {
|
|
@@ -261,13 +257,13 @@ export class ConsolePin {
|
|
|
261
257
|
},
|
|
262
258
|
},
|
|
263
259
|
]),
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
260
|
+
CodeMirror.EditorView.domEventHandlers({blur: (_e, view) => this.onBlur(view)}),
|
|
261
|
+
TextEditor.Config.baseConfiguration(expression),
|
|
262
|
+
TextEditor.Config.autocompletion,
|
|
267
263
|
],
|
|
268
264
|
}));
|
|
269
|
-
parent.appendChild(
|
|
270
|
-
return
|
|
265
|
+
parent.appendChild(editor);
|
|
266
|
+
return editor;
|
|
271
267
|
}
|
|
272
268
|
|
|
273
269
|
onBlur(editor: CodeMirror.EditorView): void {
|
|
@@ -305,9 +301,9 @@ export class ConsolePin {
|
|
|
305
301
|
}
|
|
306
302
|
|
|
307
303
|
async focus(): Promise<void> {
|
|
308
|
-
const editor = this.editor
|
|
304
|
+
const editor = this.editor;
|
|
309
305
|
editor.editor.focus();
|
|
310
|
-
editor.
|
|
306
|
+
editor.dispatch({selection: {anchor: editor.state.doc.length}});
|
|
311
307
|
}
|
|
312
308
|
|
|
313
309
|
appendToContextMenu(contextMenu: UI.ContextMenu.ContextMenu): void {
|
|
@@ -322,8 +318,7 @@ export class ConsolePin {
|
|
|
322
318
|
if (!this.editor) {
|
|
323
319
|
return;
|
|
324
320
|
}
|
|
325
|
-
const
|
|
326
|
-
const text = TE.Config.contentIncludingHint(this.editor.editor);
|
|
321
|
+
const text = TextEditor.Config.contentIncludingHint(this.editor.editor);
|
|
327
322
|
const isEditing = this.pinElement.hasFocus();
|
|
328
323
|
const throwOnSideEffect = isEditing && text !== this.committedExpression;
|
|
329
324
|
const timeout = throwOnSideEffect ? 250 : undefined;
|
|
@@ -24,7 +24,7 @@ export class CoverageDecorationManager {
|
|
|
24
24
|
this.uiSourceCodeByContentProvider = new Platform.MapUtilities.Multimap();
|
|
25
25
|
|
|
26
26
|
for (const uiSourceCode of Workspace.Workspace.WorkspaceImpl.instance().uiSourceCodes()) {
|
|
27
|
-
uiSourceCode.
|
|
27
|
+
uiSourceCode.setDecorationData(decoratorType, this);
|
|
28
28
|
}
|
|
29
29
|
Workspace.Workspace.WorkspaceImpl.instance().addEventListener(
|
|
30
30
|
Workspace.Workspace.Events.UISourceCodeAdded, this.onUISourceCodeAdded, this);
|
|
@@ -32,7 +32,7 @@ export class CoverageDecorationManager {
|
|
|
32
32
|
|
|
33
33
|
reset(): void {
|
|
34
34
|
for (const uiSourceCode of Workspace.Workspace.WorkspaceImpl.instance().uiSourceCodes()) {
|
|
35
|
-
uiSourceCode.
|
|
35
|
+
uiSourceCode.setDecorationData(decoratorType, undefined);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -45,8 +45,7 @@ export class CoverageDecorationManager {
|
|
|
45
45
|
update(updatedEntries: CoverageInfo[]): void {
|
|
46
46
|
for (const entry of updatedEntries) {
|
|
47
47
|
for (const uiSourceCode of this.uiSourceCodeByContentProvider.get(entry.getContentProvider())) {
|
|
48
|
-
uiSourceCode.
|
|
49
|
-
uiSourceCode.addLineDecoration(0, decoratorType, this);
|
|
48
|
+
uiSourceCode.setDecorationData(decoratorType, this);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
}
|
|
@@ -185,7 +184,7 @@ export class CoverageDecorationManager {
|
|
|
185
184
|
|
|
186
185
|
private onUISourceCodeAdded(event: Common.EventTarget.EventTargetEvent<Workspace.UISourceCode.UISourceCode>): void {
|
|
187
186
|
const uiSourceCode = event.data;
|
|
188
|
-
uiSourceCode.
|
|
187
|
+
uiSourceCode.setDecorationData(decoratorType, this);
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
190
|
export interface RawLocation {
|
|
@@ -8,15 +8,12 @@ import * as i18n from '../../core/i18n/i18n.js';
|
|
|
8
8
|
import * as Platform from '../../core/platform/platform.js';
|
|
9
9
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
10
10
|
import * as Bindings from '../../models/bindings/bindings.js';
|
|
11
|
-
import * as SourceFrame from '../../ui/legacy/components/source_frame/source_frame.js';
|
|
12
11
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
13
12
|
|
|
13
|
+
import {CoverageDecorationManager} from './CoverageDecorationManager.js';
|
|
14
|
+
import {CoverageListView} from './CoverageListView.js';
|
|
14
15
|
import coverageViewStyles from './coverageView.css.js';
|
|
15
16
|
|
|
16
|
-
import type * as Workspace from '../../models/workspace/workspace.js';
|
|
17
|
-
|
|
18
|
-
import {CoverageDecorationManager, decoratorType} from './CoverageDecorationManager.js';
|
|
19
|
-
import {CoverageListView} from './CoverageListView.js';
|
|
20
17
|
import type {CoverageInfo, URLCoverageInfo} from './CoverageModel.js';
|
|
21
18
|
import {CoverageModel, Events, CoverageType} from './CoverageModel.js';
|
|
22
19
|
|
|
@@ -564,103 +561,3 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
|
|
|
564
561
|
}
|
|
565
562
|
}
|
|
566
563
|
}
|
|
567
|
-
let lineDecoratorInstance: LineDecorator;
|
|
568
|
-
export class LineDecorator implements SourceFrame.SourceFrame.LineDecorator {
|
|
569
|
-
static instance({forceNew}: {forceNew: boolean} = {forceNew: false}): LineDecorator {
|
|
570
|
-
if (!lineDecoratorInstance || forceNew) {
|
|
571
|
-
lineDecoratorInstance = new LineDecorator();
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
return lineDecoratorInstance;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
private readonly listeners: WeakMap<
|
|
578
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
579
|
-
SourceFrame.SourcesTextEditor.SourcesTextEditor, (arg0: Common.EventTarget.EventTargetEvent<any>) => void>;
|
|
580
|
-
constructor() {
|
|
581
|
-
this.listeners = new WeakMap();
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
decorate(
|
|
585
|
-
uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
586
|
-
textEditor: SourceFrame.SourcesTextEditor.SourcesTextEditor): void {
|
|
587
|
-
const decorations = uiSourceCode.decorationsForType(decoratorType);
|
|
588
|
-
if (!decorations || !decorations.size) {
|
|
589
|
-
this.uninstallGutter(textEditor);
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
const decorationManager = decorations.values().next().value.data() as CoverageDecorationManager;
|
|
593
|
-
decorationManager.usageByLine(uiSourceCode).then(lineUsage => {
|
|
594
|
-
textEditor.operation(() => this.innerDecorate(uiSourceCode, textEditor, lineUsage));
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
private innerDecorate(
|
|
599
|
-
uiSourceCode: Workspace.UISourceCode.UISourceCode, textEditor: SourceFrame.SourcesTextEditor.SourcesTextEditor,
|
|
600
|
-
lineUsage: (boolean|undefined)[]): void {
|
|
601
|
-
const gutterType = LineDecorator.GUTTER_TYPE;
|
|
602
|
-
this.uninstallGutter(textEditor);
|
|
603
|
-
if (lineUsage.length) {
|
|
604
|
-
this.installGutter(textEditor, uiSourceCode.url());
|
|
605
|
-
}
|
|
606
|
-
for (let line = 0; line < lineUsage.length; ++line) {
|
|
607
|
-
// Do not decorate the line if we don't have data.
|
|
608
|
-
if (typeof lineUsage[line] !== 'boolean') {
|
|
609
|
-
continue;
|
|
610
|
-
}
|
|
611
|
-
const className = lineUsage[line] ? 'text-editor-coverage-used-marker' : 'text-editor-coverage-unused-marker';
|
|
612
|
-
const gutterElement = document.createElement('div');
|
|
613
|
-
gutterElement.classList.add(className);
|
|
614
|
-
textEditor.setGutterDecoration(line, gutterType, gutterElement);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
makeGutterClickHandler(url: string):
|
|
619
|
-
(arg0: Common.EventTarget.EventTargetEvent<SourceFrame.SourcesTextEditor.GutterClickEventData>) => void {
|
|
620
|
-
function handleGutterClick(
|
|
621
|
-
event: Common.EventTarget.EventTargetEvent<SourceFrame.SourcesTextEditor.GutterClickEventData>): void {
|
|
622
|
-
if (event.data.gutterType !== LineDecorator.GUTTER_TYPE) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
const coverageViewId = 'coverage';
|
|
626
|
-
UI.ViewManager.ViewManager.instance()
|
|
627
|
-
.showView(coverageViewId)
|
|
628
|
-
.then(() => {
|
|
629
|
-
const view = UI.ViewManager.ViewManager.instance().view(coverageViewId);
|
|
630
|
-
return view && view.widget();
|
|
631
|
-
})
|
|
632
|
-
.then(widget => {
|
|
633
|
-
const matchFormattedSuffix = url.match(/(.*):formatted$/);
|
|
634
|
-
const urlWithoutFormattedSuffix = (matchFormattedSuffix && matchFormattedSuffix[1]) || url;
|
|
635
|
-
(widget as CoverageView).selectCoverageItemByUrl(urlWithoutFormattedSuffix);
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
return handleGutterClick;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
private installGutter(textEditor: SourceFrame.SourcesTextEditor.SourcesTextEditor, url: string): void {
|
|
642
|
-
let listener = this.listeners.get(textEditor);
|
|
643
|
-
if (!listener) {
|
|
644
|
-
listener = this.makeGutterClickHandler(url);
|
|
645
|
-
this.listeners.set(textEditor, listener);
|
|
646
|
-
}
|
|
647
|
-
textEditor.installGutter(LineDecorator.GUTTER_TYPE, false);
|
|
648
|
-
textEditor.addEventListener(SourceFrame.SourcesTextEditor.Events.GutterClick, listener, this);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
private uninstallGutter(textEditor: SourceFrame.SourcesTextEditor.SourcesTextEditor): void {
|
|
652
|
-
textEditor.uninstallGutter(LineDecorator.GUTTER_TYPE);
|
|
653
|
-
const listener = this.listeners.get(textEditor);
|
|
654
|
-
if (listener) {
|
|
655
|
-
textEditor.removeEventListener(SourceFrame.SourcesTextEditor.Events.GutterClick, listener, this);
|
|
656
|
-
this.listeners.delete(textEditor);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
static readonly GUTTER_TYPE = 'CodeMirror-gutter-coverage';
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
SourceFrame.SourceFrame.registerLineDecorator({
|
|
664
|
-
lineDecorator: LineDecorator.instance,
|
|
665
|
-
decoratorType: SourceFrame.SourceFrame.DecoratorType.COVERAGE,
|
|
666
|
-
});
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
6
|
import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
7
7
|
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
8
|
-
import * as
|
|
9
|
-
import * as Legacy from '../../../ui/legacy/legacy.js';
|
|
8
|
+
import * as PanelFeedback from '../../../ui/components/panel_feedback/panel_feedback.js';
|
|
10
9
|
import * as LitHtml from '../../../ui/lit-html/lit-html.js';
|
|
11
10
|
|
|
12
11
|
import cssOverviewStartViewStyles from './cssOverviewStartView.css.js';
|
|
@@ -34,30 +33,9 @@ const UIStrings = {
|
|
|
34
33
|
*/
|
|
35
34
|
locateAffectedElements: 'Locate the affected elements in the Elements panel',
|
|
36
35
|
/**
|
|
37
|
-
*@description Title of the "Preview feature" reminder box
|
|
38
|
-
*/
|
|
39
|
-
previewFeature: 'Preview feature',
|
|
40
|
-
/**
|
|
41
|
-
*@description Sentence to convey the feature is being actively worked on and we are looking for feedback
|
|
42
|
-
*@example {https://goo.gle/css-overview-feedback} PH1
|
|
43
|
-
*/
|
|
44
|
-
activelyWorkingAndLookingForS: 'Our team is actively working on this feature and we are looking for your {PH1}!',
|
|
45
|
-
/**
|
|
46
|
-
*@description Link text of the inline anchor to navigate to a feedback page
|
|
47
|
-
*/
|
|
48
|
-
feedbackInline: 'feedback',
|
|
49
|
-
/**
|
|
50
|
-
*@description Title of the section to the quick start video and documentation to CSS Overview panel
|
|
51
|
-
*/
|
|
52
|
-
videoAndDocumentation: 'Video and documentation',
|
|
53
|
-
/**
|
|
54
36
|
*@description Title of the link to the quick start video and documentation to CSS Overview panel
|
|
55
37
|
*/
|
|
56
38
|
quickStartWithCSSOverview: 'Quick start: get started with the new CSS Overview panel',
|
|
57
|
-
/**
|
|
58
|
-
*@description Link text of the standalone button to navigate to a feedback page
|
|
59
|
-
*/
|
|
60
|
-
feedbackStandalone: 'Feedback',
|
|
61
39
|
};
|
|
62
40
|
const str_ = i18n.i18n.registerUIStrings('panels/css_overview/components/CSSOverviewStartView.ts', UIStrings);
|
|
63
41
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
@@ -77,13 +55,6 @@ export class OverviewStartRequestedEvent extends Event {
|
|
|
77
55
|
export class CSSOverviewStartView extends HTMLElement {
|
|
78
56
|
static readonly litTagName = LitHtml.literal`devtools-css-overview-start-view`;
|
|
79
57
|
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
80
|
-
#feedbackLink: HTMLElement;
|
|
81
|
-
|
|
82
|
-
constructor() {
|
|
83
|
-
super();
|
|
84
|
-
this.#feedbackLink =
|
|
85
|
-
Legacy.XLink.XLink.create(FEEDBACK_LINK, i18nString(UIStrings.feedbackInline), 'devtools-link');
|
|
86
|
-
}
|
|
87
58
|
|
|
88
59
|
connectedCallback(): void {
|
|
89
60
|
this.#shadow.adoptedStyleSheets = [cssOverviewStartViewStyles];
|
|
@@ -121,32 +92,16 @@ export class CSSOverviewStartView extends HTMLElement {
|
|
|
121
92
|
${i18nString(UIStrings.captureOverview)}
|
|
122
93
|
</${Buttons.Button.Button.litTagName}>
|
|
123
94
|
</div>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<div class="feedback-prompt">${i18n.i18n.getFormatLocalizedString(str_, UIStrings.activelyWorkingAndLookingForS, {PH1: this.#feedbackLink})}</div>
|
|
135
|
-
<div class="resources">
|
|
136
|
-
<div class="thumbnail-wrapper">
|
|
137
|
-
<${IconButton.Icon.Icon.litTagName} .data=${{
|
|
138
|
-
iconName: 'preview_feature_video_thumbnail',
|
|
139
|
-
width: '144px',
|
|
140
|
-
height: '92px',
|
|
141
|
-
} as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}>
|
|
142
|
-
</div>
|
|
143
|
-
<div>
|
|
144
|
-
<h1 class="video-doc-header">${i18nString(UIStrings.videoAndDocumentation)}</h1>
|
|
145
|
-
<x-link class="devtools-link" href=${DOC_LINK}>${i18nString(UIStrings.quickStartWithCSSOverview)}</x-link>
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
</section>
|
|
149
|
-
<x-link class="feedback-standalone" href=${FEEDBACK_LINK}>${i18nString(UIStrings.feedbackStandalone)}</x-link>
|
|
95
|
+
<${PanelFeedback.PanelFeedback.PanelFeedback.litTagName} .data=${{
|
|
96
|
+
feedbackUrl: FEEDBACK_LINK,
|
|
97
|
+
quickStartUrl: DOC_LINK,
|
|
98
|
+
quickStartLinkText: i18nString(UIStrings.quickStartWithCSSOverview),
|
|
99
|
+
} as PanelFeedback.PanelFeedback.PanelFeedbackData}>
|
|
100
|
+
</${PanelFeedback.PanelFeedback.PanelFeedback.litTagName}>
|
|
101
|
+
<${PanelFeedback.FeedbackButton.FeedbackButton.litTagName} .data=${{
|
|
102
|
+
feedbackUrl: FEEDBACK_LINK,
|
|
103
|
+
} as PanelFeedback.FeedbackButton.FeedbackButtonData}>
|
|
104
|
+
</${PanelFeedback.FeedbackButton.FeedbackButton.litTagName}>
|
|
150
105
|
</div>
|
|
151
106
|
`, this.#shadow, {
|
|
152
107
|
host: this,
|
|
@@ -120,15 +120,8 @@ h1 {
|
|
|
120
120
|
margin-bottom: 2px;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
width: fit-content;
|
|
125
|
-
padding: 0.5em;
|
|
123
|
+
devtools-feedback-button {
|
|
126
124
|
align-self: flex-end;
|
|
127
|
-
color: var(--color-primary);
|
|
128
|
-
border: 1px solid var(--color-details-hairline);
|
|
129
|
-
border-radius: 2px;
|
|
130
|
-
text-decoration: none;
|
|
131
|
-
font-weight: bold;
|
|
132
125
|
}
|
|
133
126
|
|
|
134
127
|
.resources .devtools-link {
|
|
@@ -38,10 +38,10 @@ import * as i18n from '../../core/i18n/i18n.js';
|
|
|
38
38
|
import * as Platform from '../../core/platform/platform.js';
|
|
39
39
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
40
40
|
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
41
|
+
import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
41
42
|
import * as Adorners from '../../ui/components/adorners/adorners.js';
|
|
42
43
|
import * as CodeHighlighter from '../../ui/components/code_highlighter/code_highlighter.js';
|
|
43
|
-
|
|
44
|
-
import type * as TextEditor from '../../ui/components/text_editor/text_editor.js';
|
|
44
|
+
import * as TextEditor from '../../ui/components/text_editor/text_editor.js';
|
|
45
45
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
46
46
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
47
47
|
import * as Emulation from '../emulation/emulation.js';
|
|
@@ -679,8 +679,6 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
679
679
|
const isEditable = this.hasEditableNode();
|
|
680
680
|
// clang-format off
|
|
681
681
|
if (isEditable && !this.editing) {
|
|
682
|
-
// Eagerly load CodeMirror to avoid a delay when opening the "Edit as HTML" editor when the user actually clicks on it
|
|
683
|
-
import('../../ui/components/text_editor/text_editor.js');
|
|
684
682
|
contextMenu.editSection().appendItem(i18nString(UIStrings.editAsHtml), this.editAsHTML.bind(this));
|
|
685
683
|
}
|
|
686
684
|
// clang-format on
|
|
@@ -1026,9 +1024,6 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1026
1024
|
}
|
|
1027
1025
|
});
|
|
1028
1026
|
|
|
1029
|
-
const TextEditor = await import('../../ui/components/text_editor/text_editor.js');
|
|
1030
|
-
const CodeMirror = await import('../../third_party/codemirror.next/codemirror.next.js');
|
|
1031
|
-
const {html} = await CodeMirror.html();
|
|
1032
1027
|
const editor = new TextEditor.TextEditor.TextEditor(CodeMirror.EditorState.create({
|
|
1033
1028
|
doc: initialValue,
|
|
1034
1029
|
extensions: [
|
|
@@ -1050,8 +1045,8 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1050
1045
|
]),
|
|
1051
1046
|
TextEditor.Config.baseConfiguration(initialValue),
|
|
1052
1047
|
TextEditor.Config.autocompletion,
|
|
1053
|
-
html(),
|
|
1054
|
-
TextEditor.Config.domWordWrap,
|
|
1048
|
+
CodeMirror.html.html(),
|
|
1049
|
+
TextEditor.Config.domWordWrap.instance(),
|
|
1055
1050
|
CodeMirror.EditorView.theme({
|
|
1056
1051
|
'&.cm-editor': {maxHeight: '300px'},
|
|
1057
1052
|
'.cm-scroller': {overflowY: 'auto'},
|
|
@@ -47,11 +47,11 @@ const UIStrings = {
|
|
|
47
47
|
/**
|
|
48
48
|
*@description Command that shows measuring rulers next to the emulated device.
|
|
49
49
|
*/
|
|
50
|
-
showRulers: 'Show rulers',
|
|
50
|
+
showRulers: 'Show rulers in the Device Mode toolbar',
|
|
51
51
|
/**
|
|
52
52
|
*@description Command that hides measuring rulers next to the emulated device.
|
|
53
53
|
*/
|
|
54
|
-
hideRulers: 'Hide rulers',
|
|
54
|
+
hideRulers: 'Hide rulers in the Device Mode toolbar',
|
|
55
55
|
/**
|
|
56
56
|
*@description Command that shows a frame (like a picture frame) around the emulated device.
|
|
57
57
|
*/
|
|
@@ -35,8 +35,6 @@ let loadedIssuesModule: (typeof Issues|undefined);
|
|
|
35
35
|
|
|
36
36
|
async function loadIssuesModule(): Promise<typeof Issues> {
|
|
37
37
|
if (!loadedIssuesModule) {
|
|
38
|
-
// Side-effect import resources in module.json
|
|
39
|
-
await Root.Runtime.Runtime.instance().loadModulePromise('panels/issues');
|
|
40
38
|
loadedIssuesModule = await import('./issues.js');
|
|
41
39
|
}
|
|
42
40
|
return loadedIssuesModule;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
6
|
-
import * as Root from '../../core/root/root.js';
|
|
7
6
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
8
7
|
|
|
9
8
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
@@ -30,8 +29,6 @@ let loadedMediaModule: (typeof Media|undefined);
|
|
|
30
29
|
|
|
31
30
|
async function loadMediaModule(): Promise<typeof Media> {
|
|
32
31
|
if (!loadedMediaModule) {
|
|
33
|
-
// Side-effect import resources in module.json
|
|
34
|
-
await Root.Runtime.Runtime.instance().loadModulePromise('panels/media');
|
|
35
32
|
loadedMediaModule = await import('./media.js');
|
|
36
33
|
}
|
|
37
34
|
return loadedMediaModule;
|
|
@@ -331,7 +331,8 @@ export class ResourceWebSocketFrameView extends UI.Widget.VBox {
|
|
|
331
331
|
|
|
332
332
|
this.splitWidget.setSidebarWidget(new SourceFrame.ResourceSourceFrame.ResourceSourceFrame(
|
|
333
333
|
TextUtils.StaticContentProvider.StaticContentProvider.fromString(
|
|
334
|
-
this.request.url(), Common.ResourceType.resourceTypes.WebSocket, content)
|
|
334
|
+
this.request.url(), Common.ResourceType.resourceTypes.WebSocket, content),
|
|
335
|
+
''));
|
|
335
336
|
}
|
|
336
337
|
|
|
337
338
|
private onFrameDeselected(): void {
|