chrome-devtools-frontend 1.0.1724140 → 1.0.1726686
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/.agents/skills/review-ui-widgets/SKILL.md +7 -7
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +12 -0
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +3 -3
- package/.agents/skills/ui-widgets/SKILL.md +2 -1
- package/docs/cookbook/dependencies.md +6 -4
- package/front_end/core/i18n/i18nImpl.ts +1 -1
- package/front_end/core/root/Runtime.ts +1 -1
- package/front_end/core/sdk/ResourceTreeModel.ts +16 -0
- package/front_end/entrypoints/js_app/js_app.ts +2 -5
- package/front_end/entrypoints/node_app/node_app.ts +2 -3
- package/front_end/generated/InspectorBackendCommands.ts +1 -1
- package/front_end/generated/protocol.ts +1 -0
- package/front_end/models/ai_assistance/skills/lighthouse.md +2 -1
- package/front_end/models/ai_assistance/skills/network.md +1 -0
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +26 -2
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +1 -1
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +2 -7
- package/front_end/models/ai_assistance/tools/RunLighthouse.ts +2 -2
- package/front_end/models/comment_manager/CommentManager.ts +0 -6
- package/front_end/models/comment_manager/CommentThread.ts +23 -19
- package/front_end/models/elements/StyleChanges.ts +66 -0
- package/front_end/models/trace/EventsSerializer.ts +2 -7
- package/front_end/models/trace/ModelImpl.ts +0 -2
- package/front_end/models/trace/handlers/FlowsHandler.ts +37 -29
- package/front_end/models/trace/helpers/SyntheticEvents.ts +10 -37
- package/front_end/models/trace/insights/RenderBlocking.ts +3 -1
- package/front_end/models/trace/lantern/simulation/Simulator.ts +4 -0
- package/front_end/models/trace/lantern/types/Lantern.ts +1 -0
- package/front_end/panels/accessibility/SourceOrderView.ts +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +90 -0
- package/front_end/panels/application/StorageView.ts +196 -174
- package/front_end/panels/application/SubAppsView.ts +2 -2
- package/front_end/panels/application/preloading/PreloadingView.ts +360 -336
- package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingGrid.ts +6 -3
- package/front_end/panels/application/preloading/components/RuleSetGrid.ts +17 -17
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -2
- package/front_end/panels/application/preloading/preloadingView.css +12 -4
- package/front_end/panels/application/preloading/preloadingViewDropDown.css +1 -1
- package/front_end/panels/application/storageView.css +16 -21
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +2 -2
- package/front_end/panels/browser_debugger/browser_debugger-meta.ts +6 -8
- package/front_end/panels/comments/CommentsPane.ts +26 -9
- package/front_end/panels/comments/commentsPane.css +25 -6
- package/front_end/panels/common/CommentThreadWidget.ts +2 -2
- package/front_end/panels/common/CommentsOverlayWidget.ts +94 -35
- package/front_end/panels/common/commentThreadWidget.css +17 -0
- package/front_end/panels/common/commentsOverlay.css +5 -10
- package/front_end/panels/common/common-meta.ts +11 -1
- package/front_end/panels/elements/ClassesPaneWidget.ts +130 -88
- package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +7 -33
- package/front_end/panels/elements/DOMTreeWidget.ts +7 -3
- package/front_end/panels/elements/ElementStatePaneWidget.ts +11 -1
- package/front_end/panels/elements/PropertyRenderer.ts +3 -2
- package/front_end/panels/elements/StyleEditorWidget.ts +60 -41
- package/front_end/panels/elements/StylePropertiesSection.ts +32 -5
- package/front_end/panels/elements/StylePropertyTreeElement.ts +227 -162
- package/front_end/panels/event_listeners/EventListenersView.ts +11 -8
- package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +1 -1
- package/front_end/panels/network/NetworkDataGridNode.ts +3 -1
- package/front_end/panels/network/RequestConditionsDrawer.ts +1 -1
- package/front_end/panels/network/RequestPayloadView.ts +12 -5
- package/front_end/panels/profiler/HeapProfileView.ts +28 -6
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +7 -3
- package/front_end/panels/protocol_monitor/JSONEditor.ts +0 -1
- package/front_end/panels/recorder/RecorderPanel.ts +2 -2
- package/front_end/panels/settings/SettingsScreen.ts +1 -1
- package/front_end/panels/sources/NavigatorView.ts +105 -45
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +8 -5
- package/front_end/panels/sources/SourcesNavigator.ts +421 -213
- package/front_end/panels/sources/SourcesPanel.ts +6 -4
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +10 -5
- package/front_end/panels/sources/sources-meta.ts +4 -15
- package/front_end/panels/sources/sourcesNavigator.css +5 -0
- package/front_end/panels/timeline/ModificationsManager.ts +0 -2
- package/front_end/panels/timeline/README.md +2 -0
- package/front_end/panels/timeline/TimelineCommentController.ts +132 -30
- package/front_end/panels/timeline/TimelinePanel.ts +4 -0
- package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -1
- package/front_end/panels/timeline/utils/Treemap.ts +8 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/comments/CommentAnchorResolver.ts +3 -0
- package/front_end/ui/comments/CommentOverlayManager.ts +2 -4
- package/front_end/ui/components/lists/List.ts +14 -1
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +23 -14
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +3 -0
- package/front_end/ui/legacy/Toolbar.ts +0 -1
- package/front_end/ui/legacy/Treeoutline.ts +7 -2
- package/front_end/ui/legacy/UIUtils.ts +4 -1
- package/front_end/ui/legacy/components/inline_editor/Swatches.ts +19 -6
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +20 -11
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +27 -7
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
- package/package.json +1 -1
|
@@ -64,7 +64,6 @@ interface ViewInput {
|
|
|
64
64
|
togglePassiveListener(listener: SDK.DOMDebuggerModel.EventListener): void;
|
|
65
65
|
removeListener(listener: SDK.DOMDebuggerModel.EventListener): boolean;
|
|
66
66
|
reveal(object: SDK.RemoteObject.RemoteObject): void;
|
|
67
|
-
linkifier: Components.Linkifier.Linkifier;
|
|
68
67
|
listeners: Map<string, ListenerEntry[]>;
|
|
69
68
|
filter?: {showFramework: boolean, showPassive: boolean, showBlocking: boolean};
|
|
70
69
|
}
|
|
@@ -167,7 +166,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
167
166
|
?hidden=${shouldHide(listener)}>
|
|
168
167
|
<span class=event-listener-details>
|
|
169
168
|
${ObjectUI.ObjectPropertiesSection.renderPropertyValue(
|
|
170
|
-
object, /* wasThrown */ false, /* showPreview */ false
|
|
169
|
+
object, /* wasThrown */ false, /* showPreview */ false)}
|
|
171
170
|
<devtools-button
|
|
172
171
|
.iconName=${'bin'}
|
|
173
172
|
.variant=${Buttons.Button.Variant.ICON}
|
|
@@ -184,9 +183,16 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
184
183
|
${i18nString(UIStrings.togglePassive)}
|
|
185
184
|
</button>` : Lit.nothing}
|
|
186
185
|
<span class=event-listener-tree-subtitle>
|
|
187
|
-
${
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
${widget(Components.Linkifier.ScriptLocationLink, {
|
|
187
|
+
target: listener.location().debuggerModel.target(),
|
|
188
|
+
scriptId: listener.location().scriptId,
|
|
189
|
+
sourceURL: listener.sourceURL(),
|
|
190
|
+
lineNumber: listener.location().lineNumber,
|
|
191
|
+
options: {
|
|
192
|
+
columnNumber: listener.location().columnNumber,
|
|
193
|
+
tabStop: true,
|
|
194
|
+
},
|
|
195
|
+
})}
|
|
190
196
|
</span>
|
|
191
197
|
</span>
|
|
192
198
|
<ul role=group ${widget(ObjectUI.ObjectPropertiesSection.ObjectTreeWidget, {objectTree})} ${
|
|
@@ -205,7 +211,6 @@ export class EventListenersView extends UI.Widget.VBox {
|
|
|
205
211
|
#filter: {showFramework: boolean, showPassive: boolean, showBlocking: boolean}|undefined;
|
|
206
212
|
#view: View;
|
|
207
213
|
#listeners?: Map<string, ListenerEntry[]>;
|
|
208
|
-
#linkifier = new Components.Linkifier.Linkifier();
|
|
209
214
|
constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
|
|
210
215
|
super(element);
|
|
211
216
|
this.#view = view;
|
|
@@ -278,9 +283,7 @@ export class EventListenersView extends UI.Widget.VBox {
|
|
|
278
283
|
void Common.Revealer.reveal(object);
|
|
279
284
|
}
|
|
280
285
|
},
|
|
281
|
-
linkifier: this.#linkifier,
|
|
282
286
|
};
|
|
283
|
-
this.#linkifier.reset();
|
|
284
287
|
this.#view(input, {}, this.contentElement);
|
|
285
288
|
this.eventListenersArrivedForTest();
|
|
286
289
|
}
|
|
@@ -65,7 +65,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLE
|
|
|
65
65
|
return html`
|
|
66
66
|
<devtools-checkbox
|
|
67
67
|
title=${valueTypeToLocalizedString(type)}
|
|
68
|
-
|
|
68
|
+
.checked=${input.valueTypes.has(type)}
|
|
69
69
|
@change=${(e: Event) => {
|
|
70
70
|
const checkbox = e.target as HTMLInputElement;
|
|
71
71
|
input.onToggle(type, checkbox.checked);
|
|
@@ -1367,7 +1367,9 @@ export class NetworkRequestNode extends NetworkNode {
|
|
|
1367
1367
|
}
|
|
1368
1368
|
|
|
1369
1369
|
private openInNewTab(): void {
|
|
1370
|
-
|
|
1370
|
+
// Only open URLs with web-safe schemes. Do not open privileged or other non-web-safe
|
|
1371
|
+
// schemes (such as `chrome:`, `devtools:`, `file:`, or `blob:devtools:`).
|
|
1372
|
+
if (!Common.ParsedURL.hasWebSafeScheme(this.requestInternal.url())) {
|
|
1371
1373
|
return;
|
|
1372
1374
|
}
|
|
1373
1375
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this.requestInternal.url());
|
|
@@ -150,7 +150,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
150
150
|
<style>${requestConditionsDrawerStyles}</style>
|
|
151
151
|
<devtools-toolbar jslog=${VisualLogging.toolbar()}>
|
|
152
152
|
<devtools-checkbox
|
|
153
|
-
|
|
153
|
+
.checked=${input.enabled}
|
|
154
154
|
@click=${input.toggleEnabled}
|
|
155
155
|
.jslogContext=${'network.enable-request-blocking'}>
|
|
156
156
|
${i18nString(UIStrings.enableBlockingAndThrottling)}
|
|
@@ -125,7 +125,7 @@ export interface ViewInput {
|
|
|
125
125
|
queryParameters: SDK.NetworkRequest.NameValue[]|null;
|
|
126
126
|
objectTree: ObjectUI.ObjectPropertiesSection.ObjectTree|null;
|
|
127
127
|
onPayloadContextMenu(contextMenu: UI.ContextMenu.ContextMenu): void;
|
|
128
|
-
onPayloadToggle(expanded: boolean): void;
|
|
128
|
+
onPayloadToggle(expanded: boolean, recursively?: boolean): void;
|
|
129
129
|
|
|
130
130
|
/** Raw binary content data for the request body (when base64-encoded by backend). */
|
|
131
131
|
binaryPayloadContentData: TextUtils.ContentData.ContentData|null;
|
|
@@ -204,7 +204,9 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
204
204
|
<li role=treeitem class="source-code object-properties-section-root-element object-properties-section"
|
|
205
205
|
toggle-on-click
|
|
206
206
|
?open=${objectTree.expanded}
|
|
207
|
-
@expand=${
|
|
207
|
+
@expand=${
|
|
208
|
+
(e: UI.TreeOutline.TreeViewElement.ExpandEvent) =>
|
|
209
|
+
input.onPayloadToggle(e.detail.expanded, e.detail.recursively)}
|
|
208
210
|
@contextmenu=${onPayloadContextMenu}>
|
|
209
211
|
${objectTree.object.description}
|
|
210
212
|
${objectTree.object.hasChildren ? ObjectUI.ObjectPropertiesSection.renderObjectTree(objectTree) : nothing}
|
|
@@ -500,10 +502,15 @@ export class RequestPayloadView extends UI.Widget.VBox {
|
|
|
500
502
|
},
|
|
501
503
|
);
|
|
502
504
|
},
|
|
503
|
-
onPayloadToggle: (expanded: boolean): void => {
|
|
504
|
-
if (this.#objectTree) {
|
|
505
|
-
|
|
505
|
+
onPayloadToggle: (expanded: boolean, recursively = false): void => {
|
|
506
|
+
if (!this.#objectTree) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (expanded && recursively) {
|
|
510
|
+
void this.#objectTree.expandRecursively();
|
|
511
|
+
return;
|
|
506
512
|
}
|
|
513
|
+
this.#objectTree.expanded = expanded;
|
|
507
514
|
},
|
|
508
515
|
binaryPayloadContentData: this.#binaryPayloadContentData,
|
|
509
516
|
requestUrl: this.request?.url() ?? Platform.DevToolsPath.EmptyUrlString,
|
|
@@ -409,19 +409,41 @@ export class HeapProfileView extends UI.View.SimpleView implements UI.Searchable
|
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
#setupTimelineOverview(): void {
|
|
412
|
-
|
|
412
|
+
// Only the profile that is being recorded receives stats updates. Profiles
|
|
413
|
+
// loaded from a file are also marked as being recorded while they load.
|
|
414
|
+
if (this.profileType.hasTemporaryView() && !this.profileHeader.fromFile() &&
|
|
415
|
+
this.profileType.profileBeingRecorded() === this.profileHeader) {
|
|
413
416
|
this.timelineOverview.addEventListener(Events.IDS_RANGE_CHANGED, this.onIdsRangeChanged.bind(this));
|
|
414
417
|
this.timelineOverview.start();
|
|
415
418
|
|
|
416
419
|
this.profileType.addEventListener(SamplingHeapProfileType.Events.STATS_UPDATE, this.onStatsUpdate, this);
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
this.timelineOverview.stop();
|
|
420
|
-
this.timelineOverview.updateGrid();
|
|
421
|
-
});
|
|
420
|
+
this.profileType.addEventListener(ProfileEvents.PROFILE_COMPLETE, this.#onProfileComplete, this);
|
|
421
|
+
this.profileType.addEventListener(ProfileEvents.REMOVE_PROFILE_HEADER, this.#onProfileRemoved, this);
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
+
#onProfileComplete({data: profile}: Common.EventTarget.EventTargetEvent<ProfileHeader>): void {
|
|
426
|
+
if (profile !== this.profileHeader) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
this.#stopTimelineTracking();
|
|
430
|
+
this.timelineOverview.updateGrid();
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
#onProfileRemoved({data: profile}: Common.EventTarget.EventTargetEvent<ProfileHeader>): void {
|
|
434
|
+
// A profile that is removed while it is being recorded never completes.
|
|
435
|
+
if (profile === this.profileHeader) {
|
|
436
|
+
this.#stopTimelineTracking();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
#stopTimelineTracking(): void {
|
|
441
|
+
this.profileType.removeEventListener(SamplingHeapProfileType.Events.STATS_UPDATE, this.onStatsUpdate, this);
|
|
442
|
+
this.profileType.removeEventListener(ProfileEvents.PROFILE_COMPLETE, this.#onProfileComplete, this);
|
|
443
|
+
this.profileType.removeEventListener(ProfileEvents.REMOVE_PROFILE_HEADER, this.#onProfileRemoved, this);
|
|
444
|
+
this.timelineOverview.stop();
|
|
445
|
+
}
|
|
446
|
+
|
|
425
447
|
override async toolbarItems(): Promise<TemplateResult> {
|
|
426
448
|
const currentViewType = this.viewType.get();
|
|
427
449
|
const isFlame = currentViewType === ViewTypes.FLAME;
|
|
@@ -533,14 +533,18 @@ export class HeapSnapshotViewportDataGrid extends HeapSnapshotSortableDataGrid {
|
|
|
533
533
|
const scrollBottom = scrollTop + this.scrollContainer.offsetHeight;
|
|
534
534
|
if (height >= scrollTop && height < scrollBottom) {
|
|
535
535
|
if (!node.dataGrid) {
|
|
536
|
-
this.updateVisibleNodes(
|
|
536
|
+
this.updateVisibleNodes(true);
|
|
537
537
|
}
|
|
538
538
|
return Promise.resolve(node);
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
const scrollGap = 40;
|
|
542
542
|
this.scrollContainer.scrollTop = Math.max(0, height - scrollGap);
|
|
543
|
-
this.updateVisibleNodes(
|
|
543
|
+
this.updateVisibleNodes(true);
|
|
544
|
+
if (!node.dataGrid) {
|
|
545
|
+
this.scrollContainer.scrollTop = Math.max(0, height - scrollGap);
|
|
546
|
+
this.updateVisibleNodes(true);
|
|
547
|
+
}
|
|
544
548
|
return new Promise(resolve => {
|
|
545
549
|
if (this.scrollToResolveCallback) {
|
|
546
550
|
this.scrollToResolveCallback();
|
|
@@ -551,7 +555,7 @@ export class HeapSnapshotViewportDataGrid extends HeapSnapshotSortableDataGrid {
|
|
|
551
555
|
if (!this.scrollToResolveCallback) {
|
|
552
556
|
return;
|
|
553
557
|
}
|
|
554
|
-
this.updateVisibleNodes(
|
|
558
|
+
this.updateVisibleNodes(!node.dataGrid);
|
|
555
559
|
this.scrollToResolveCallback();
|
|
556
560
|
this.scrollToResolveCallback = null;
|
|
557
561
|
});
|
|
@@ -241,7 +241,7 @@ export interface ViewInput {
|
|
|
241
241
|
onRemoveBreakpoint: (index: number) => void;
|
|
242
242
|
onExtensionViewClosed: () => void;
|
|
243
243
|
onExportMenuClosed: () => void;
|
|
244
|
-
onExportOptionSelected: (event: Menus.
|
|
244
|
+
onExportOptionSelected: (event: Menus.Menu.MenuItemSelectedEvent) => void;
|
|
245
245
|
onRecordingFinished: () => void;
|
|
246
246
|
handleAddAssertionEvent: () => void;
|
|
247
247
|
onSetRecording: (event: Event) => void;
|
|
@@ -1594,7 +1594,7 @@ export class RecorderPanel extends UI.Widget.VBox<DocumentFragment> {
|
|
|
1594
1594
|
}
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
1597
|
-
async #onExportOptionSelected(event: Menus.
|
|
1597
|
+
async #onExportOptionSelected(event: Menus.Menu.MenuItemSelectedEvent): Promise<void> {
|
|
1598
1598
|
if (typeof event.itemValue !== 'string') {
|
|
1599
1599
|
throw new Error('Invalid export option value');
|
|
1600
1600
|
}
|
|
@@ -442,7 +442,7 @@ export const EXPERIMENTS_SETTINGS_TAB_DEFAULT_VIEW: ExperimentsSettingsTabView =
|
|
|
442
442
|
class="experiment-label"
|
|
443
443
|
name=${experiment.name}
|
|
444
444
|
title=${experiment.title}
|
|
445
|
-
|
|
445
|
+
.checked=${experiment.isEnabled()}
|
|
446
446
|
.jslogContext=${experiment.name}
|
|
447
447
|
@click=${(e: Event) => {
|
|
448
448
|
const checkbox = e.currentTarget as UI.UIUtils.CheckboxLabel;
|
|
@@ -140,6 +140,20 @@ const UIStrings = {
|
|
|
140
140
|
* shows up for disconnected automatic workspace folders.
|
|
141
141
|
*/
|
|
142
142
|
connectFolderToWorkspace: 'Connect to workspace',
|
|
143
|
+
/**
|
|
144
|
+
* @description A context menu item in the Sources navigator of the Sources panel.
|
|
145
|
+
*/
|
|
146
|
+
run: 'Run',
|
|
147
|
+
/**
|
|
148
|
+
* @description Text to save content as a specific file type.
|
|
149
|
+
*/
|
|
150
|
+
saveAs: 'Save as…',
|
|
151
|
+
/**
|
|
152
|
+
* @description An error message logged to the Console panel when the user uses
|
|
153
|
+
* the "Save as…" context menu in the Sources panel and the operation
|
|
154
|
+
* fails.
|
|
155
|
+
*/
|
|
156
|
+
saveAsFailed: 'Failed to save file to disk',
|
|
143
157
|
} as const;
|
|
144
158
|
|
|
145
159
|
const str_ = i18n.i18n.registerUIStrings('panels/sources/NavigatorView.ts', UIStrings);
|
|
@@ -174,30 +188,22 @@ const TYPE_ORDERS = new Map([
|
|
|
174
188
|
|
|
175
189
|
export interface ViewInput {
|
|
176
190
|
treeElement: HTMLElement;
|
|
177
|
-
placeholder: UI.Widget.Widget|null;
|
|
178
191
|
showTree: boolean;
|
|
179
|
-
onContextMenu: (event: Event) => void;
|
|
180
192
|
}
|
|
181
193
|
|
|
182
194
|
export type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
183
195
|
|
|
184
196
|
export const DEFAULT_VIEW: View = (input, _output, target): void => {
|
|
185
|
-
const showPlaceholder =
|
|
197
|
+
const showPlaceholder = !input.showTree;
|
|
186
198
|
// clang-format off
|
|
187
199
|
render(
|
|
188
200
|
html`
|
|
189
201
|
<style>${navigatorViewStyles}</style>
|
|
190
202
|
<slot name="header"></slot>
|
|
191
|
-
<div class="vbox flex-auto" ?hidden=${!showPlaceholder}
|
|
192
|
-
<slot name="placeholder">
|
|
193
|
-
${input.placeholder ? html`
|
|
194
|
-
<devtools-widget class="vbox flex-auto" ?hidden=${!showPlaceholder}>
|
|
195
|
-
${input.placeholder.element}
|
|
196
|
-
</devtools-widget>
|
|
197
|
-
` : Lit.nothing}
|
|
198
|
-
</slot>
|
|
203
|
+
<div class="vbox flex-auto" ?hidden=${!showPlaceholder}>
|
|
204
|
+
<slot name="placeholder"></slot>
|
|
199
205
|
</div>
|
|
200
|
-
<div class="vbox flex-auto" ?hidden=${showPlaceholder}
|
|
206
|
+
<div class="vbox flex-auto" ?hidden=${showPlaceholder}>
|
|
201
207
|
${input.treeElement}
|
|
202
208
|
</div>
|
|
203
209
|
`,
|
|
@@ -205,11 +211,28 @@ export const DEFAULT_VIEW: View = (input, _output, target): void => {
|
|
|
205
211
|
// clang-format on
|
|
206
212
|
};
|
|
207
213
|
|
|
208
|
-
export
|
|
214
|
+
export const enum Events {
|
|
215
|
+
UI_SOURCE_CODE_ADDED = 'ui-source-code-added',
|
|
216
|
+
SOURCE_SELECTED = 'source-selected',
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface SourceSelectedEvent {
|
|
220
|
+
uiSourceCode: Workspace.UISourceCode.UISourceCode;
|
|
221
|
+
focusSource: boolean;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface EventTypes {
|
|
225
|
+
[Events.UI_SOURCE_CODE_ADDED]: Workspace.UISourceCode.UISourceCode;
|
|
226
|
+
[Events.SOURCE_SELECTED]: SourceSelectedEvent;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const NavigatorViewBase: Common.ObjectWrapper.EventMixin<EventTypes, typeof UI.Widget.VBox> =
|
|
230
|
+
Common.ObjectWrapper.eventMixin(UI.Widget.VBox);
|
|
231
|
+
|
|
232
|
+
export class NavigatorView extends NavigatorViewBase implements SDK.TargetManager.Observer {
|
|
209
233
|
static override readonly INJECT: readonly[typeof Bindings.NetworkProject.NetworkProjectManager] =
|
|
210
234
|
[Bindings.NetworkProject.NetworkProjectManager] as const;
|
|
211
235
|
|
|
212
|
-
private placeholder: UI.Widget.Widget|null;
|
|
213
236
|
scriptsTree: UI.TreeOutline.TreeOutlineInShadow;
|
|
214
237
|
private readonly uiSourceCodeNodes:
|
|
215
238
|
Platform.MapUtilities.Multimap<Workspace.UISourceCode.UISourceCode, NavigatorUISourceCodeTreeNode>;
|
|
@@ -223,7 +246,9 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
223
246
|
private navigatorGroupByAuthoredSetting?: Common.Settings.Setting<boolean>;
|
|
224
247
|
#navigatorGroupByAuthoredChangeListener?: () => void;
|
|
225
248
|
#enableAuthoredGrouping = false;
|
|
226
|
-
#
|
|
249
|
+
#projectFilter?: (project: Workspace.Workspace.Project) => boolean;
|
|
250
|
+
#workspace = Workspace.Workspace.WorkspaceImpl.instance();
|
|
251
|
+
#initialized = false;
|
|
227
252
|
private groupByFrame?: boolean;
|
|
228
253
|
private groupByAuthored?: boolean;
|
|
229
254
|
private groupByDomain?: boolean;
|
|
@@ -235,15 +260,10 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
235
260
|
[networkProjectManager]: UI.Widget.WidgetDependencies<typeof NavigatorView> =
|
|
236
261
|
[Bindings.NetworkProject.NetworkProjectManager.instance()],
|
|
237
262
|
view: View = DEFAULT_VIEW,
|
|
238
|
-
options?: UI.Widget.WidgetOptions,
|
|
239
263
|
) {
|
|
240
|
-
super(element, {
|
|
241
|
-
...options,
|
|
242
|
-
useShadowDom: true,
|
|
243
|
-
});
|
|
264
|
+
super(element, {useShadowDom: true});
|
|
244
265
|
this.#view = view;
|
|
245
266
|
|
|
246
|
-
this.placeholder = null;
|
|
247
267
|
this.scriptsTree = new UI.TreeOutline.TreeOutlineInShadow(UI.TreeOutline.TreeVariant.NAVIGATION_TREE);
|
|
248
268
|
this.scriptsTree.registerRequiredCSS(navigatorTreeStyles);
|
|
249
269
|
|
|
@@ -286,12 +306,11 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
286
306
|
SDK.TargetManager.Events.NAME_CHANGED, this.targetNameChanged, this);
|
|
287
307
|
|
|
288
308
|
SDK.TargetManager.TargetManager.instance().observeTargets(this);
|
|
289
|
-
this.resetWorkspace(Workspace.Workspace.WorkspaceImpl.instance());
|
|
290
|
-
this.#workspace.uiSourceCodes().forEach(this.addUISourceCode.bind(this));
|
|
291
309
|
networkProjectManager.addEventListener(Bindings.NetworkProject.Events.FRAME_ATTRIBUTION_ADDED,
|
|
292
310
|
this.frameAttributionAdded, this);
|
|
293
311
|
networkProjectManager.addEventListener(Bindings.NetworkProject.Events.FRAME_ATTRIBUTION_REMOVED,
|
|
294
312
|
this.frameAttributionRemoved, this);
|
|
313
|
+
this.requestUpdate();
|
|
295
314
|
}
|
|
296
315
|
|
|
297
316
|
override wasShown(): void {
|
|
@@ -319,7 +338,22 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
319
338
|
this.#navigatorGroupByAuthoredChangeListener = this.groupingChanged.bind(this);
|
|
320
339
|
this.navigatorGroupByAuthoredSetting.addChangeListener(this.#navigatorGroupByAuthoredChangeListener);
|
|
321
340
|
}
|
|
322
|
-
if (this.#
|
|
341
|
+
if (this.#initialized && Boolean(this.groupByAuthored) !== Boolean(this.navigatorGroupByAuthoredSetting?.get())) {
|
|
342
|
+
this.groupingChanged();
|
|
343
|
+
}
|
|
344
|
+
this.requestUpdate();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
get projectFilter(): ((project: Workspace.Workspace.Project) => boolean)|undefined {
|
|
348
|
+
return this.#projectFilter;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
set projectFilter(projectFilter: ((project: Workspace.Workspace.Project) => boolean)|undefined) {
|
|
352
|
+
if (this.#projectFilter === projectFilter) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
this.#projectFilter = projectFilter;
|
|
356
|
+
if (this.#initialized) {
|
|
323
357
|
this.groupingChanged();
|
|
324
358
|
}
|
|
325
359
|
this.requestUpdate();
|
|
@@ -371,18 +405,16 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
371
405
|
return Platform.StringUtilities.naturalOrderComparator(treeElement1.titleAsText(), treeElement2.titleAsText());
|
|
372
406
|
}
|
|
373
407
|
|
|
374
|
-
setPlaceholder(placeholder: UI.Widget.Widget): void {
|
|
375
|
-
console.assert(!this.placeholder, 'A placeholder widget was already set');
|
|
376
|
-
this.placeholder = placeholder;
|
|
377
|
-
this.requestUpdate();
|
|
378
|
-
}
|
|
379
|
-
|
|
380
408
|
override performUpdate(): void {
|
|
409
|
+
if (!this.#initialized) {
|
|
410
|
+
this.#initialized = true;
|
|
411
|
+
this.initGrouping();
|
|
412
|
+
this.resetWorkspace(this.#workspace);
|
|
413
|
+
this.#workspace.uiSourceCodes().forEach(this.addUISourceCode.bind(this));
|
|
414
|
+
}
|
|
381
415
|
this.#view({
|
|
382
416
|
treeElement: this.scriptsTree.element,
|
|
383
|
-
placeholder: this.placeholder,
|
|
384
417
|
showTree: Boolean(this.scriptsTree.firstChild()),
|
|
385
|
-
onContextMenu: this.handleContextMenu.bind(this),
|
|
386
418
|
},
|
|
387
419
|
undefined, this.contentElement);
|
|
388
420
|
}
|
|
@@ -497,11 +529,10 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
497
529
|
}
|
|
498
530
|
}
|
|
499
531
|
|
|
500
|
-
workspace(): Workspace.Workspace.WorkspaceImpl {
|
|
501
|
-
return this.#workspace;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
532
|
acceptProject(project: Workspace.Workspace.Project): boolean {
|
|
533
|
+
if (this.#projectFilter) {
|
|
534
|
+
return this.#projectFilter(project);
|
|
535
|
+
}
|
|
505
536
|
return !project.isServiceProject();
|
|
506
537
|
}
|
|
507
538
|
|
|
@@ -558,7 +589,7 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
558
589
|
} else {
|
|
559
590
|
this.addUISourceCodeNode(uiSourceCode, null);
|
|
560
591
|
}
|
|
561
|
-
this.
|
|
592
|
+
this.dispatchEventToListeners(Events.UI_SOURCE_CODE_ADDED, uiSourceCode);
|
|
562
593
|
}
|
|
563
594
|
|
|
564
595
|
private addUISourceCodeNode(
|
|
@@ -588,9 +619,6 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
588
619
|
this.selectDefaultTreeNode();
|
|
589
620
|
}
|
|
590
621
|
|
|
591
|
-
uiSourceCodeAdded(_uiSourceCode: Workspace.UISourceCode.UISourceCode): void {
|
|
592
|
-
}
|
|
593
|
-
|
|
594
622
|
private uiSourceCodeAddedCallback(event: Common.EventTarget.EventTargetEvent<Workspace.UISourceCode.UISourceCode>):
|
|
595
623
|
void {
|
|
596
624
|
const uiSourceCode = event.data;
|
|
@@ -912,11 +940,13 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
912
940
|
}
|
|
913
941
|
|
|
914
942
|
sourceSelected(uiSourceCode: Workspace.UISourceCode.UISourceCode, focusSource: boolean): void {
|
|
943
|
+
this.dispatchEventToListeners(Events.SOURCE_SELECTED, {uiSourceCode, focusSource});
|
|
915
944
|
void Common.Revealer.reveal(uiSourceCode, !focusSource);
|
|
916
945
|
}
|
|
917
946
|
|
|
918
947
|
#isUISourceCodeOrAnyAncestorSelected(node: NavigatorUISourceCodeTreeNode): boolean {
|
|
919
|
-
const selectedTreeElement =
|
|
948
|
+
const selectedTreeElement =
|
|
949
|
+
(this.scriptsTree.selectedTreeElement as NavigatorSourceTreeElement | NavigatorFolderTreeElement | null);
|
|
920
950
|
const selectedNode = selectedTreeElement?.node;
|
|
921
951
|
let currentNode: NavigatorTreeNode|null = node;
|
|
922
952
|
while (currentNode) {
|
|
@@ -924,7 +954,7 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
924
954
|
return true;
|
|
925
955
|
}
|
|
926
956
|
currentNode = currentNode.parent;
|
|
927
|
-
if (!(
|
|
957
|
+
if (!(currentNode instanceof NavigatorGroupTreeNode || currentNode instanceof NavigatorFolderTreeNode)) {
|
|
928
958
|
break;
|
|
929
959
|
}
|
|
930
960
|
}
|
|
@@ -1022,9 +1052,6 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
1022
1052
|
}
|
|
1023
1053
|
}
|
|
1024
1054
|
|
|
1025
|
-
handleContextMenu(_event: Event): void {
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
1055
|
private async renameShortcut(): Promise<boolean> {
|
|
1029
1056
|
const selectedTreeElement = (this.scriptsTree.selectedTreeElement as NavigatorSourceTreeElement | null);
|
|
1030
1057
|
const node = selectedTreeElement?.node;
|
|
@@ -1074,6 +1101,22 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
1074
1101
|
|
|
1075
1102
|
handleFileContextMenu(event: Event, node: NavigatorUISourceCodeTreeNode): void {
|
|
1076
1103
|
const uiSourceCode = node.uiSourceCode();
|
|
1104
|
+
if (Snippets.ScriptSnippetFileSystem.isSnippetsUISourceCode(uiSourceCode)) {
|
|
1105
|
+
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
1106
|
+
contextMenu.headerSection().appendItem(i18nString(UIStrings.run),
|
|
1107
|
+
() => Snippets.ScriptSnippetFileSystem.evaluateScriptSnippet(uiSourceCode),
|
|
1108
|
+
{jslogContext: 'run'});
|
|
1109
|
+
contextMenu.editSection().appendItem(i18nString(UIStrings.rename), () => this.rename(node, false),
|
|
1110
|
+
{jslogContext: 'rename'});
|
|
1111
|
+
contextMenu.editSection().appendItem(i18nString(UIStrings.remove),
|
|
1112
|
+
() => uiSourceCode.project().deleteFile(uiSourceCode),
|
|
1113
|
+
{jslogContext: 'remove'});
|
|
1114
|
+
contextMenu.saveSection().appendItem(i18nString(UIStrings.saveAs), this.handleSaveAs.bind(this, uiSourceCode),
|
|
1115
|
+
{jslogContext: 'save-as'});
|
|
1116
|
+
void contextMenu.show();
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1077
1120
|
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
1078
1121
|
contextMenu.appendApplicableItems(uiSourceCode);
|
|
1079
1122
|
|
|
@@ -1093,6 +1136,23 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
|
1093
1136
|
void contextMenu.show();
|
|
1094
1137
|
}
|
|
1095
1138
|
|
|
1139
|
+
private async handleSaveAs(uiSourceCode: Workspace.UISourceCode.UISourceCode): Promise<void> {
|
|
1140
|
+
uiSourceCode.commitWorkingCopy();
|
|
1141
|
+
const contentData = await uiSourceCode.requestContentData();
|
|
1142
|
+
if (TextUtils.ContentData.ContentData.isError(contentData)) {
|
|
1143
|
+
console.error(`Failed to retrieve content for ${uiSourceCode.url()}: ${contentData}`);
|
|
1144
|
+
Common.Console.Console.instance().error(i18nString(UIStrings.saveAsFailed), /* show=*/ false);
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
await Workspace.FileManager.FileManager.instance().save(this.addJSExtension(uiSourceCode.url()), contentData,
|
|
1148
|
+
/* forceSaveAs=*/ true);
|
|
1149
|
+
Workspace.FileManager.FileManager.instance().close(uiSourceCode.url());
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
private addJSExtension(url: Platform.DevToolsPath.UrlString): Platform.DevToolsPath.UrlString {
|
|
1153
|
+
return Common.ParsedURL.ParsedURL.concatenate(url, '.js');
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1096
1156
|
private async handleDeleteFolder(node: NavigatorTreeNode): Promise<void> {
|
|
1097
1157
|
const shouldRemove = await UI.UIUtils.ConfirmDialog.show(
|
|
1098
1158
|
i18nString(UIStrings.actionCannotBeUndone), i18nString(UIStrings.deleteFolder), undefined,
|
|
@@ -75,7 +75,7 @@ interface ViewInput {
|
|
|
75
75
|
scope: SDK.DebuggerModel.ScopeChainEntry,
|
|
76
76
|
objectTree: ObjectUI.ObjectPropertiesSection.ObjectTree,
|
|
77
77
|
}>|null;
|
|
78
|
-
onToggle: (objectTree: ObjectUI.ObjectPropertiesSection.ObjectTree, expanded: boolean) => void;
|
|
78
|
+
onToggle: (objectTree: ObjectUI.ObjectPropertiesSection.ObjectTree, expanded: boolean, recursively?: boolean) => void;
|
|
79
79
|
onContextMenu: (
|
|
80
80
|
objectTree: ObjectUI.ObjectPropertiesSection.ObjectTree,
|
|
81
81
|
contextMenu: UI.ContextMenu.ContextMenu,
|
|
@@ -100,9 +100,8 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
100
100
|
class="scope-chain-sidebar-pane-section"
|
|
101
101
|
aria-label=${title}
|
|
102
102
|
?open=${objectTree.expanded}
|
|
103
|
-
@expand=${(e:
|
|
104
|
-
|
|
105
|
-
input.onToggle(objectTree, customEvent.detail.expanded);
|
|
103
|
+
@expand=${(e: UI.TreeOutline.TreeViewElement.ExpandEvent) => {
|
|
104
|
+
input.onToggle(objectTree, e.detail.expanded, e.detail.recursively);
|
|
106
105
|
}}
|
|
107
106
|
@contextmenu=${(e: Event) => {
|
|
108
107
|
const contextMenu = new UI.ContextMenu.ContextMenu(e);
|
|
@@ -232,7 +231,11 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
|
|
|
232
231
|
linkifier: this.#linkifier,
|
|
233
232
|
isPaused: Boolean(this.#scopeChainModel),
|
|
234
233
|
scopeChain: this.#scopeChain,
|
|
235
|
-
onToggle: (objectTree: ObjectUI.ObjectPropertiesSection.ObjectTree, expanded: boolean) => {
|
|
234
|
+
onToggle: (objectTree: ObjectUI.ObjectPropertiesSection.ObjectTree, expanded: boolean, recursively = false) => {
|
|
235
|
+
if (expanded && recursively) {
|
|
236
|
+
void objectTree.expandRecursively().then(() => this.requestUpdate());
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
236
239
|
objectTree.expanded = expanded;
|
|
237
240
|
this.requestUpdate();
|
|
238
241
|
},
|