chrome-devtools-frontend 1.0.1618066 → 1.0.1621678
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/docs/checklist/README.md +8 -7
- package/eslint.config.mjs +7 -0
- package/front_end/core/sdk/NetworkManager.ts +23 -2
- package/front_end/core/sdk/ServerSentEventsProtocol.ts +1 -1
- package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +119 -13
- package/front_end/generated/InspectorBackendCommands.ts +7 -7
- package/front_end/generated/SupportedCSSProperties.js +100 -100
- package/front_end/generated/protocol-mapping.d.ts +1 -9
- package/front_end/generated/protocol-proxy-api.d.ts +1 -9
- package/front_end/generated/protocol.ts +6 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +512 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +95 -104
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +9 -16
- package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +25 -4
- package/front_end/models/bindings/SymbolizedError.ts +86 -2
- package/front_end/models/issues_manager/GenericIssue.ts +50 -1
- package/front_end/models/issues_manager/descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/front_end/models/issues_manager/descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/front_end/models/issues_manager/descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/front_end/models/issues_manager/descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/front_end/models/issues_manager/descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +10 -2
- package/front_end/models/stack_trace/DetailedErrorStackParser.ts +11 -3
- package/front_end/models/stack_trace/ErrorStackParser.ts +18 -0
- package/front_end/models/trace/insights/Common.ts +4 -0
- package/front_end/models/trace/insights/types.ts +1 -1
- package/front_end/models/web_mcp/WebMCPModel.ts +11 -1
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +115 -3
- package/front_end/panels/ai_assistance/components/WalkthroughUtils.ts +1 -1
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +9 -2
- package/front_end/panels/application/WebMCPView.ts +217 -85
- package/front_end/panels/application/webMCPView.css +260 -199
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +9 -5
- package/front_end/panels/changes/ChangesSidebar.ts +2 -2
- package/front_end/panels/changes/ChangesView.ts +4 -7
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -19
- package/front_end/panels/coverage/CoverageView.ts +4 -5
- package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +0 -1
- package/front_end/panels/elements/ElementsPanel.ts +9 -12
- package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
- package/front_end/panels/elements/PropertiesWidget.ts +1 -1
- package/front_end/panels/elements/StylePropertiesSection.ts +1 -1
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +19 -20
- package/front_end/panels/elements/components/ElementsBreadcrumbsUtils.ts +29 -29
- package/front_end/panels/elements/components/QueryContainer.ts +5 -6
- package/front_end/panels/elements/components/components.ts +0 -2
- package/front_end/panels/emulation/MediaQueryInspector.ts +4 -7
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +47 -66
- package/front_end/panels/network/RequestConditionsDrawer.ts +6 -4
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +6 -9
- package/front_end/panels/protocol_monitor/JSONEditor.ts +2 -2
- package/front_end/panels/search/SearchView.ts +4 -7
- package/front_end/panels/sources/DebuggerPausedMessage.ts +18 -22
- package/front_end/panels/sources/ThreadsSidebarPane.ts +2 -4
- package/front_end/panels/web_audio/WebAudioView.ts +5 -4
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/icon_button/iconButton.css +1 -0
- package/front_end/ui/components/lists/list.css +4 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +1 -3
- package/front_end/ui/legacy/Treeoutline.ts +5 -1
- package/front_end/ui/legacy/ViewRegistration.ts +2 -2
- package/front_end/ui/legacy/Widget.ts +9 -2
- package/front_end/ui/legacy/components/utils/Linkifier.ts +32 -11
- package/front_end/ui/visual_logging/KnownContextValues.ts +19 -0
- package/package.json +1 -1
- package/front_end/Images/src/dots-circle.svg +0 -10
- package/front_end/panels/elements/components/Helper.ts +0 -35
|
@@ -544,16 +544,15 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
if (selectedNode) {
|
|
547
|
-
const
|
|
548
|
-
const crumbs = [activeNode];
|
|
547
|
+
const crumbs = [selectedNode];
|
|
549
548
|
|
|
550
549
|
for (let current: (SDK.DOMModel.DOMNode|null) = selectedNode.parentNode; current; current = current.parentNode) {
|
|
551
|
-
crumbs.push(
|
|
550
|
+
crumbs.push(current);
|
|
552
551
|
}
|
|
553
552
|
|
|
554
553
|
this.breadcrumbs.data = {
|
|
555
554
|
crumbs,
|
|
556
|
-
selectedNode
|
|
555
|
+
selectedNode,
|
|
557
556
|
};
|
|
558
557
|
|
|
559
558
|
if (this.accessibilityTreeView) {
|
|
@@ -938,16 +937,14 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
938
937
|
*/
|
|
939
938
|
|
|
940
939
|
// Get the current set of active crumbs
|
|
941
|
-
const
|
|
942
|
-
const existingCrumbs = [activeNode];
|
|
940
|
+
const existingCrumbs = [selectedNode];
|
|
943
941
|
for (let current: (SDK.DOMModel.DOMNode|null) = selectedNode.parentNode; current; current = current.parentNode) {
|
|
944
|
-
existingCrumbs.push(
|
|
942
|
+
existingCrumbs.push(current);
|
|
945
943
|
}
|
|
946
944
|
|
|
947
945
|
/* Get the change nodes from the event & convert them to breadcrumb nodes */
|
|
948
|
-
const
|
|
949
|
-
|
|
950
|
-
newNodes.forEach(crumb => nodesThatHaveChangedMap.set(crumb.id, crumb));
|
|
946
|
+
const nodesThatHaveChangedMap = new Map<Protocol.DOM.NodeId, SDK.DOMModel.DOMNode>();
|
|
947
|
+
nodes.forEach(crumb => nodesThatHaveChangedMap.set(crumb.id, crumb));
|
|
951
948
|
|
|
952
949
|
/* Loop over our existing crumbs, and if any have an ID that matches an ID from the new nodes
|
|
953
950
|
* that we have, use the new node, rather than the one we had, because it's changed.
|
|
@@ -959,12 +956,12 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
959
956
|
|
|
960
957
|
this.breadcrumbs.data = {
|
|
961
958
|
crumbs: newSetOfCrumbs,
|
|
962
|
-
selectedNode
|
|
959
|
+
selectedNode,
|
|
963
960
|
};
|
|
964
961
|
}
|
|
965
962
|
|
|
966
963
|
private crumbNodeSelected(event: ElementsComponents.ElementsBreadcrumbs.NodeSelectedEvent): void {
|
|
967
|
-
this.selectDOMNode(event.
|
|
964
|
+
this.selectDOMNode(event.node, true);
|
|
968
965
|
}
|
|
969
966
|
|
|
970
967
|
private leaveUserAgentShadowDOM(node: SDK.DOMModel.DOMNode): SDK.DOMModel.DOMNode {
|
|
@@ -460,10 +460,14 @@ export interface ViewInput {
|
|
|
460
460
|
descendantDecorations: Decoration[];
|
|
461
461
|
decorationsTooltip: string;
|
|
462
462
|
indent: number;
|
|
463
|
+
|
|
464
|
+
editorState: CodeMirror.EditorState|null;
|
|
465
|
+
editorWidth: number|null;
|
|
463
466
|
}
|
|
464
467
|
|
|
465
468
|
export interface ViewOutput {
|
|
466
469
|
contentElement?: HTMLElement;
|
|
470
|
+
editorRef?: TextEditor.TextEditor.TextEditor;
|
|
467
471
|
}
|
|
468
472
|
|
|
469
473
|
export function adornerRef(): DirectiveResult<typeof Lit.Directives.RefDirective> {
|
|
@@ -936,11 +940,12 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
|
936
940
|
const gutterContainerClasses = {
|
|
937
941
|
'has-decorations': input.decorations.length || input.descendantDecorations.length,
|
|
938
942
|
'gutter-container': true,
|
|
943
|
+
hidden: Boolean(input.editorState),
|
|
939
944
|
};
|
|
940
945
|
// clang-format off
|
|
941
946
|
render(html`
|
|
942
947
|
<div ${ref(el => { output.contentElement = el as HTMLElement; })}>
|
|
943
|
-
${input.node ? html`<span class="highlight">${renderTitle(
|
|
948
|
+
${input.node ? html`<span class="highlight ${input.editorState ? 'hidden' : ''}">${renderTitle(
|
|
944
949
|
input.node,
|
|
945
950
|
input.isClosingTag,
|
|
946
951
|
input.expanded,
|
|
@@ -951,7 +956,7 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
|
951
956
|
input.onExpand,
|
|
952
957
|
)}</span>` : nothing}
|
|
953
958
|
${input.isHovered || input.isSelected ? html`
|
|
954
|
-
<div class="selection fill" style=${`margin-left: ${-input.indent}px`}></div>
|
|
959
|
+
<div class="selection fill ${input.editorState ? 'hidden' : ''}" style=${`margin-left: ${-input.indent}px`}></div>
|
|
955
960
|
` : nothing}
|
|
956
961
|
<div class=${Lit.Directives.classMap(gutterContainerClasses)}
|
|
957
962
|
style="left: ${-input.indent}px"
|
|
@@ -964,7 +969,7 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
|
964
969
|
${input.descendantDecorations.map(d => html`<div class="elements-gutter-decoration elements-has-decorated-children" style="--decoration-color: ${d.color}"></div>`)}
|
|
965
970
|
</div>` : nothing}
|
|
966
971
|
</div>
|
|
967
|
-
${hasAdorners ? html`<div class="adorner-container ${
|
|
972
|
+
${hasAdorners ? html`<div class="adorner-container ${(input.editorState) ? 'hidden' : ''}">
|
|
968
973
|
${maybeRenderAdAdorner(input)}
|
|
969
974
|
${input.showViewSourceAdorner ? html`<devtools-adorner
|
|
970
975
|
.name=${ElementsComponents.AdornerManager.RegisteredAdorners.VIEW_SOURCE}
|
|
@@ -1123,10 +1128,10 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
|
1123
1128
|
</devtools-adorner>` : nothing}
|
|
1124
1129
|
</div>`: nothing}
|
|
1125
1130
|
${input.isSelected ? html`
|
|
1126
|
-
<span class="selected-hint" title=${i18nString(UIStrings.useSInTheConsoleToReferToThis, { PH1: '$0' })} aria-hidden="true"></span>
|
|
1131
|
+
<span class="selected-hint ${input.editorState ? 'hidden' : ''}" title=${i18nString(UIStrings.useSInTheConsoleToReferToThis, { PH1: '$0' })} aria-hidden="true"></span>
|
|
1127
1132
|
` : nothing}
|
|
1128
1133
|
${input.showAiButton ? html`
|
|
1129
|
-
<span class="ai-button-container">
|
|
1134
|
+
<span class="ai-button-container ${input.editorState ? 'hidden' : ''}">
|
|
1130
1135
|
<devtools-floating-button
|
|
1131
1136
|
icon-name=${AIAssistance.AiUtils.getIconName()}
|
|
1132
1137
|
title=${input.aiButtonTitle || ''}
|
|
@@ -1136,6 +1141,15 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
|
1136
1141
|
</devtools-floating-button>
|
|
1137
1142
|
</span>
|
|
1138
1143
|
` : nothing}
|
|
1144
|
+
${input.editorState ? html`<div @keydown=${(event: KeyboardEvent) => {
|
|
1145
|
+
if (event.key === 'Escape') {
|
|
1146
|
+
event.consume(true);
|
|
1147
|
+
}
|
|
1148
|
+
}} class="source-code elements-tree-editor" style="width: ${input.editorWidth ?? 0}px;">
|
|
1149
|
+
<devtools-text-editor .state=${input.editorState} ${ref(el => {
|
|
1150
|
+
output.editorRef = el as TextEditor.TextEditor.TextEditor;
|
|
1151
|
+
})}></devtools-text-editor>
|
|
1152
|
+
</div>`: nothing}
|
|
1139
1153
|
</div>
|
|
1140
1154
|
`, target);
|
|
1141
1155
|
// clang-format on
|
|
@@ -1151,7 +1165,9 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1151
1165
|
private inClipboard: boolean;
|
|
1152
1166
|
#hovered: boolean;
|
|
1153
1167
|
private editing: EditorHandles|null;
|
|
1154
|
-
|
|
1168
|
+
#editorRef?: TextEditor.TextEditor.TextEditor;
|
|
1169
|
+
#editorState: CodeMirror.EditorState|null = null;
|
|
1170
|
+
#editorWidth: number|null = null;
|
|
1155
1171
|
expandAllButtonElement: UI.TreeOutline.TreeElement|null;
|
|
1156
1172
|
#elementIssues = new Map<string, IssuesManager.Issue.Issue>();
|
|
1157
1173
|
#nodeElementToIssue = new Map<Element, IssuesManager.Issue.Issue[]>();
|
|
@@ -1288,9 +1304,6 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1288
1304
|
|
|
1289
1305
|
// ClearNode param is used to clean DOM after in-place editing..
|
|
1290
1306
|
performUpdate(clearNode = false): void {
|
|
1291
|
-
if (this.editing) {
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
1307
|
const output: ViewOutput = {};
|
|
1295
1308
|
DEFAULT_VIEW(
|
|
1296
1309
|
{
|
|
@@ -1380,10 +1393,13 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1380
1393
|
void action.execute();
|
|
1381
1394
|
}
|
|
1382
1395
|
},
|
|
1396
|
+
editorState: this.#editorState,
|
|
1397
|
+
editorWidth: this.#editorWidth,
|
|
1383
1398
|
},
|
|
1384
1399
|
output, this.listItemElement);
|
|
1385
1400
|
|
|
1386
1401
|
this.#contentElement = output.contentElement;
|
|
1402
|
+
this.#editorRef = output.editorRef;
|
|
1387
1403
|
if (this.#updateRecord) {
|
|
1388
1404
|
this.#updateRecord = null;
|
|
1389
1405
|
}
|
|
@@ -1683,10 +1699,7 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1683
1699
|
}
|
|
1684
1700
|
}
|
|
1685
1701
|
|
|
1686
|
-
|
|
1687
|
-
if (this.editing) {
|
|
1688
|
-
this.editing.cancel();
|
|
1689
|
-
}
|
|
1702
|
+
clearView(): void {
|
|
1690
1703
|
// Update the element to clean up adorner registrations with the
|
|
1691
1704
|
// ElementsPanel.
|
|
1692
1705
|
// We do not change the ElementsTreeElement state in case the
|
|
@@ -1744,9 +1757,17 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1744
1757
|
descendantDecorations: [],
|
|
1745
1758
|
decorationsTooltip: '',
|
|
1746
1759
|
indent: 0,
|
|
1760
|
+
editorState: null,
|
|
1761
|
+
editorWidth: null,
|
|
1747
1762
|
},
|
|
1748
1763
|
{}, this.listItemElement);
|
|
1764
|
+
}
|
|
1749
1765
|
|
|
1766
|
+
override onunbind(): void {
|
|
1767
|
+
if (this.editing) {
|
|
1768
|
+
this.editing.cancel();
|
|
1769
|
+
}
|
|
1770
|
+
this.clearView();
|
|
1750
1771
|
if (this.treeOutline && this.treeOutline.treeElementByNode.get(this.nodeInternal) === this) {
|
|
1751
1772
|
this.treeOutline.treeElementByNode.delete(this.nodeInternal);
|
|
1752
1773
|
}
|
|
@@ -2553,7 +2574,6 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2553
2574
|
this.editing = {
|
|
2554
2575
|
commit: editorHandles.commit,
|
|
2555
2576
|
cancel: editorHandles.cancel,
|
|
2556
|
-
editor: undefined,
|
|
2557
2577
|
resize: () => {},
|
|
2558
2578
|
};
|
|
2559
2579
|
}
|
|
@@ -2569,31 +2589,13 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2569
2589
|
return;
|
|
2570
2590
|
}
|
|
2571
2591
|
|
|
2572
|
-
const initialValue = convertUnicodeCharsToHTMLEntities(maybeInitialValue).text;
|
|
2573
|
-
this.htmlEditElement = document.createElement('div');
|
|
2574
|
-
this.htmlEditElement.className = 'source-code elements-tree-editor';
|
|
2575
|
-
|
|
2576
|
-
// Hide header items.
|
|
2577
|
-
let child: (ChildNode|null) = this.listItemElement.firstChild;
|
|
2578
|
-
while (child) {
|
|
2579
|
-
if (child instanceof HTMLElement) {
|
|
2580
|
-
child.style.display = 'none';
|
|
2581
|
-
}
|
|
2582
|
-
child = child.nextSibling;
|
|
2583
|
-
}
|
|
2584
2592
|
// Hide children item.
|
|
2585
2593
|
if (this.childrenListElement) {
|
|
2586
2594
|
this.childrenListElement.style.display = 'none';
|
|
2587
2595
|
}
|
|
2596
|
+
const initialValue = convertUnicodeCharsToHTMLEntities(maybeInitialValue).text;
|
|
2588
2597
|
// Append editor.
|
|
2589
|
-
this.
|
|
2590
|
-
this.htmlEditElement.addEventListener('keydown', event => {
|
|
2591
|
-
if (event.key === 'Escape') {
|
|
2592
|
-
event.consume(true);
|
|
2593
|
-
}
|
|
2594
|
-
});
|
|
2595
|
-
|
|
2596
|
-
const editor = new TextEditor.TextEditor.TextEditor(CodeMirror.EditorState.create({
|
|
2598
|
+
this.#editorState = CodeMirror.EditorState.create({
|
|
2597
2599
|
doc: initialValue,
|
|
2598
2600
|
extensions: [
|
|
2599
2601
|
CodeMirror.keymap.of([
|
|
@@ -2623,58 +2625,49 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2623
2625
|
}),
|
|
2624
2626
|
CodeMirror.EditorView.domEventHandlers({
|
|
2625
2627
|
focusout: event => {
|
|
2628
|
+
if (!this.#editorRef) {
|
|
2629
|
+
return;
|
|
2630
|
+
}
|
|
2626
2631
|
// The relatedTarget is null when no element gains focus, e.g. switching windows.
|
|
2627
2632
|
const relatedTarget = (event.relatedTarget as Node | null);
|
|
2628
|
-
if (relatedTarget && !relatedTarget.isSelfOrDescendant(
|
|
2633
|
+
if (relatedTarget && !relatedTarget.isSelfOrDescendant(this.#editorRef)) {
|
|
2629
2634
|
this.editing?.commit();
|
|
2630
2635
|
}
|
|
2631
2636
|
},
|
|
2632
2637
|
}),
|
|
2633
2638
|
],
|
|
2634
|
-
})
|
|
2635
|
-
this.
|
|
2639
|
+
});
|
|
2640
|
+
this.performUpdate();
|
|
2636
2641
|
resize.call(this);
|
|
2637
|
-
this
|
|
2638
|
-
|
|
2639
|
-
|
|
2642
|
+
this.#editorRef?.focus();
|
|
2643
|
+
this.editing = {commit: commit.bind(this), cancel: dispose.bind(this), resize: resize.bind(this)};
|
|
2640
2644
|
this.treeOutline?.setMultilineEditing(this.editing);
|
|
2641
2645
|
|
|
2642
2646
|
function resize(this: ElementsTreeElement): void {
|
|
2643
|
-
if (this.treeOutline
|
|
2644
|
-
this
|
|
2647
|
+
if (this.treeOutline) {
|
|
2648
|
+
this.#editorWidth = this.treeOutline.visibleWidth() - this.computeLeftIndent() - 30;
|
|
2649
|
+
this.performUpdate();
|
|
2645
2650
|
}
|
|
2646
2651
|
}
|
|
2647
2652
|
|
|
2648
2653
|
function commit(this: ElementsTreeElement): void {
|
|
2649
|
-
if (this
|
|
2650
|
-
commitCallback(initialValue, this.
|
|
2654
|
+
if (this.#editorRef) {
|
|
2655
|
+
commitCallback(initialValue, this.#editorRef.editor.state.doc.toString());
|
|
2651
2656
|
}
|
|
2652
2657
|
dispose.call(this);
|
|
2653
2658
|
}
|
|
2654
2659
|
|
|
2655
2660
|
function dispose(this: ElementsTreeElement): void {
|
|
2656
|
-
if (!this
|
|
2661
|
+
if (!this.#editorRef) {
|
|
2657
2662
|
return;
|
|
2658
2663
|
}
|
|
2659
2664
|
this.editing = null;
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
if (this.htmlEditElement) {
|
|
2663
|
-
this.listItemElement.removeChild(this.htmlEditElement);
|
|
2664
|
-
}
|
|
2665
|
-
this.htmlEditElement = undefined;
|
|
2665
|
+
this.#editorState = null;
|
|
2666
|
+
this.performUpdate();
|
|
2666
2667
|
// Unhide children item.
|
|
2667
2668
|
if (this.childrenListElement) {
|
|
2668
2669
|
this.childrenListElement.style.removeProperty('display');
|
|
2669
2670
|
}
|
|
2670
|
-
// Unhide header items.
|
|
2671
|
-
let child: (ChildNode|null) = this.listItemElement.firstChild;
|
|
2672
|
-
while (child) {
|
|
2673
|
-
if (child instanceof HTMLElement) {
|
|
2674
|
-
child.style.removeProperty('display');
|
|
2675
|
-
}
|
|
2676
|
-
child = child.nextSibling;
|
|
2677
|
-
}
|
|
2678
2671
|
|
|
2679
2672
|
if (this.treeOutline) {
|
|
2680
2673
|
this.treeOutline.setMultilineEditing(null);
|
|
@@ -3016,7 +3009,7 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3016
3009
|
}
|
|
3017
3010
|
|
|
3018
3011
|
toggleEditAsHTML(callback?: ((arg0: boolean) => void), startEditing?: boolean): void {
|
|
3019
|
-
if (this.editing && this
|
|
3012
|
+
if (this.editing && this.#editorState) {
|
|
3020
3013
|
this.editing.commit();
|
|
3021
3014
|
return;
|
|
3022
3015
|
}
|
|
@@ -3222,7 +3215,6 @@ export function convertUnicodeCharsToHTMLEntities(text: string): {
|
|
|
3222
3215
|
export interface EditorHandles {
|
|
3223
3216
|
commit: () => void;
|
|
3224
3217
|
cancel: () => void;
|
|
3225
|
-
editor?: TextEditor.TextEditor.TextEditor;
|
|
3226
3218
|
resize: () => void;
|
|
3227
3219
|
}
|
|
3228
3220
|
|
|
@@ -103,7 +103,7 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
|
103
103
|
${input.objectTree && input.allChildrenFiltered ? html`
|
|
104
104
|
<div class="gray-info-message">${i18nString(UIStrings.noMatchingProperty)}</div>
|
|
105
105
|
` : nothing}
|
|
106
|
-
<devtools-tree @treeelementexpand=${onExpand} .template=${html`
|
|
106
|
+
<devtools-tree show-selection-on-keyboard-focus @treeelementexpand=${onExpand} .template=${html`
|
|
107
107
|
<ul role=tree class="source-code object-properties-section">
|
|
108
108
|
<style>${ObjectUI.ObjectPropertiesSection.objectValueStyles}</style>;
|
|
109
109
|
<style>${ObjectUI.ObjectPropertiesSection.objectPropertiesSectionStyles}</style>;
|
|
@@ -1181,7 +1181,7 @@ export class StylePropertiesSection {
|
|
|
1181
1181
|
|
|
1182
1182
|
const containerElement = new ElementsComponents.QueryContainer.QueryContainer();
|
|
1183
1183
|
containerElement.data = {
|
|
1184
|
-
container:
|
|
1184
|
+
container: container.containerNode,
|
|
1185
1185
|
queryName: containerQuery.name,
|
|
1186
1186
|
onContainerLinkClick: event => {
|
|
1187
1187
|
event.preventDefault();
|
|
@@ -7,7 +7,7 @@ import '../../../ui/kit/kit.js';
|
|
|
7
7
|
import '../../../ui/components/node_text/node_text.js';
|
|
8
8
|
|
|
9
9
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
10
|
-
import
|
|
10
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
11
11
|
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
12
12
|
import * as RenderCoordinator from '../../../ui/components/render_coordinator/render_coordinator.js';
|
|
13
13
|
import * as Lit from '../../../ui/lit/lit.js';
|
|
@@ -15,7 +15,6 @@ import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
|
15
15
|
|
|
16
16
|
import elementsBreadcrumbsStyles from './elementsBreadcrumbs.css.js';
|
|
17
17
|
import {crumbsToRender, type UserScrollPosition} from './ElementsBreadcrumbsUtils.js';
|
|
18
|
-
import type {DOMNode} from './Helper.js';
|
|
19
18
|
|
|
20
19
|
const {html} = Lit;
|
|
21
20
|
|
|
@@ -39,25 +38,25 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
39
38
|
|
|
40
39
|
export class NodeSelectedEvent extends Event {
|
|
41
40
|
static readonly eventName = 'breadcrumbsnodeselected';
|
|
42
|
-
|
|
41
|
+
node: SDK.DOMModel.DOMNode;
|
|
43
42
|
|
|
44
|
-
constructor(node: DOMNode) {
|
|
43
|
+
constructor(node: SDK.DOMModel.DOMNode) {
|
|
45
44
|
super(NodeSelectedEvent.eventName, {});
|
|
46
|
-
this.
|
|
45
|
+
this.node = node;
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
export interface ElementsBreadcrumbsData {
|
|
51
|
-
selectedNode: DOMNode|null;
|
|
52
|
-
crumbs: DOMNode[];
|
|
50
|
+
selectedNode: SDK.DOMModel.DOMNode|null;
|
|
51
|
+
crumbs: SDK.DOMModel.DOMNode[];
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
export class ElementsBreadcrumbs extends HTMLElement {
|
|
56
55
|
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
57
56
|
readonly #resizeObserver = new ResizeObserver(() => this.#checkForOverflowOnResize());
|
|
58
57
|
|
|
59
|
-
#crumbsData: readonly DOMNode[] = [];
|
|
60
|
-
#selectedDOMNode:
|
|
58
|
+
#crumbsData: readonly SDK.DOMModel.DOMNode[] = [];
|
|
59
|
+
#selectedDOMNode: SDK.DOMModel.DOMNode|null = null;
|
|
61
60
|
#overflowing = false;
|
|
62
61
|
#userScrollPosition: UserScrollPosition = 'start';
|
|
63
62
|
#isObservingResize = false;
|
|
@@ -75,7 +74,7 @@ export class ElementsBreadcrumbs extends HTMLElement {
|
|
|
75
74
|
this.#resizeObserver.disconnect();
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
#onCrumbClick(node: DOMNode): (event: Event) => void {
|
|
77
|
+
#onCrumbClick(node: SDK.DOMModel.DOMNode): (event: Event) => void {
|
|
79
78
|
return (event: Event): void => {
|
|
80
79
|
event.preventDefault();
|
|
81
80
|
this.dispatchEvent(new NodeSelectedEvent(node));
|
|
@@ -121,20 +120,20 @@ export class ElementsBreadcrumbs extends HTMLElement {
|
|
|
121
120
|
void this.#updateScrollState(crumbWindow);
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
#onCrumbMouseMove(node: DOMNode): () => void {
|
|
125
|
-
return (): void => node.
|
|
123
|
+
#onCrumbMouseMove(node: SDK.DOMModel.DOMNode): () => void {
|
|
124
|
+
return (): void => node.highlight();
|
|
126
125
|
}
|
|
127
126
|
|
|
128
|
-
#onCrumbMouseLeave(
|
|
129
|
-
|
|
127
|
+
#onCrumbMouseLeave(): void {
|
|
128
|
+
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight();
|
|
130
129
|
}
|
|
131
130
|
|
|
132
|
-
#onCrumbFocus(node: DOMNode): () => void {
|
|
133
|
-
return (): void => node.
|
|
131
|
+
#onCrumbFocus(node: SDK.DOMModel.DOMNode): () => void {
|
|
132
|
+
return (): void => node.highlight();
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
#onCrumbBlur(
|
|
137
|
-
|
|
135
|
+
#onCrumbBlur(): void {
|
|
136
|
+
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight();
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
#engageResizeObserver(): void {
|
|
@@ -306,9 +305,9 @@ export class ElementsBreadcrumbs extends HTMLElement {
|
|
|
306
305
|
jslog=${VisualLogging.item().track({click:true, resize:true})}
|
|
307
306
|
@click=${this.#onCrumbClick(crumb.node)}
|
|
308
307
|
@mousemove=${this.#onCrumbMouseMove(crumb.node)}
|
|
309
|
-
@mouseleave=${this.#onCrumbMouseLeave
|
|
308
|
+
@mouseleave=${this.#onCrumbMouseLeave}
|
|
310
309
|
@focus=${this.#onCrumbFocus(crumb.node)}
|
|
311
|
-
@blur=${this.#onCrumbBlur
|
|
310
|
+
@blur=${this.#onCrumbBlur}
|
|
312
311
|
>
|
|
313
312
|
<devtools-node-text data-node-title=${crumb.title.main} .data=${{
|
|
314
313
|
nodeTitle: crumb.title.main,
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
|
-
|
|
7
|
-
import type {DOMNode} from './Helper.js';
|
|
6
|
+
import type * as SDK from '../../../core/sdk/sdk.js';
|
|
8
7
|
|
|
9
8
|
const UIStrings = {
|
|
10
9
|
/**
|
|
@@ -21,8 +20,7 @@ export type UserScrollPosition = 'start'|'middle'|'end';
|
|
|
21
20
|
export interface Crumb {
|
|
22
21
|
title: CrumbTitle;
|
|
23
22
|
selected: boolean;
|
|
24
|
-
node: DOMNode;
|
|
25
|
-
originalNode: unknown;
|
|
23
|
+
node: SDK.DOMModel.DOMNode;
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
export interface CrumbTitle {
|
|
@@ -30,25 +28,25 @@ export interface CrumbTitle {
|
|
|
30
28
|
extras: {id?: string, classes?: string[]};
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
export const crumbsToRender =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
export const crumbsToRender =
|
|
32
|
+
(crumbs: readonly SDK.DOMModel.DOMNode[], selectedNode: SDK.DOMModel.DOMNode|null): Crumb[] => {
|
|
33
|
+
if (!selectedNode) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
37
|
+
return crumbs
|
|
38
|
+
.filter(crumb => {
|
|
39
|
+
return crumb.nodeType() !== Node.DOCUMENT_NODE;
|
|
40
|
+
})
|
|
41
|
+
.map(crumb => {
|
|
42
|
+
return {
|
|
43
|
+
title: determineElementTitle(crumb),
|
|
44
|
+
selected: crumb.id === selectedNode.id,
|
|
45
|
+
node: crumb,
|
|
46
|
+
};
|
|
47
|
+
})
|
|
48
|
+
.reverse();
|
|
49
|
+
};
|
|
52
50
|
|
|
53
51
|
const makeCrumbTitle = (main: string, extras = {}): CrumbTitle => {
|
|
54
52
|
return {
|
|
@@ -57,13 +55,15 @@ const makeCrumbTitle = (main: string, extras = {}): CrumbTitle => {
|
|
|
57
55
|
};
|
|
58
56
|
};
|
|
59
57
|
|
|
60
|
-
export const determineElementTitle = (domNode: DOMNode): CrumbTitle => {
|
|
61
|
-
|
|
58
|
+
export const determineElementTitle = (domNode: SDK.DOMModel.DOMNode): CrumbTitle => {
|
|
59
|
+
const nodeType = domNode.nodeType();
|
|
60
|
+
switch (nodeType) {
|
|
62
61
|
case Node.ELEMENT_NODE: {
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const pseudoType = domNode.pseudoType();
|
|
63
|
+
if (pseudoType) {
|
|
64
|
+
return makeCrumbTitle('::' + pseudoType);
|
|
65
65
|
}
|
|
66
|
-
const crumbTitle = makeCrumbTitle(domNode.
|
|
66
|
+
const crumbTitle = makeCrumbTitle(domNode.nodeNameInCorrectCase());
|
|
67
67
|
|
|
68
68
|
const id = domNode.getAttribute('id');
|
|
69
69
|
if (id) {
|
|
@@ -86,8 +86,8 @@ export const determineElementTitle = (domNode: DOMNode): CrumbTitle => {
|
|
|
86
86
|
case Node.DOCUMENT_TYPE_NODE:
|
|
87
87
|
return makeCrumbTitle('<!doctype>');
|
|
88
88
|
case Node.DOCUMENT_FRAGMENT_NODE:
|
|
89
|
-
return makeCrumbTitle(domNode.shadowRootType ? '#shadow-root' : domNode.
|
|
89
|
+
return makeCrumbTitle(domNode.shadowRootType() ? '#shadow-root' : domNode.nodeNameInCorrectCase());
|
|
90
90
|
default:
|
|
91
|
-
return makeCrumbTitle(domNode.
|
|
91
|
+
return makeCrumbTitle(domNode.nodeNameInCorrectCase());
|
|
92
92
|
}
|
|
93
93
|
};
|
|
@@ -10,7 +10,6 @@ import * as SDK from '../../../core/sdk/sdk.js';
|
|
|
10
10
|
import * as Lit from '../../../ui/lit/lit.js';
|
|
11
11
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
12
12
|
|
|
13
|
-
import type {DOMNode} from './Helper.js';
|
|
14
13
|
import queryContainerStyles from './queryContainer.css.js';
|
|
15
14
|
|
|
16
15
|
const {render, html} = Lit;
|
|
@@ -24,7 +23,7 @@ export class QueriedSizeRequestedEvent extends Event {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
export interface QueryContainerData {
|
|
27
|
-
container: DOMNode;
|
|
26
|
+
container: SDK.DOMModel.DOMNode;
|
|
28
27
|
queryName?: string;
|
|
29
28
|
onContainerLinkClick: (event: Event) => void;
|
|
30
29
|
}
|
|
@@ -32,7 +31,7 @@ export interface QueryContainerData {
|
|
|
32
31
|
export class QueryContainer extends HTMLElement {
|
|
33
32
|
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
34
33
|
#queryName?: string;
|
|
35
|
-
#container?: DOMNode;
|
|
34
|
+
#container?: SDK.DOMModel.DOMNode;
|
|
36
35
|
#onContainerLinkClick?: (event: Event) => void;
|
|
37
36
|
#isContainerLinkHovered = false;
|
|
38
37
|
#queriedSizeDetails?: SDK.CSSContainerQuery.ContainerQueriedSizeDetails;
|
|
@@ -50,13 +49,13 @@ export class QueryContainer extends HTMLElement {
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
async #onContainerLinkMouseEnter(): Promise<void> {
|
|
53
|
-
this.#container?.
|
|
52
|
+
this.#container?.highlight('container-outline');
|
|
54
53
|
this.#isContainerLinkHovered = true;
|
|
55
54
|
this.dispatchEvent(new QueriedSizeRequestedEvent());
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
#onContainerLinkMouseLeave(): void {
|
|
59
|
-
|
|
58
|
+
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight();
|
|
60
59
|
this.#isContainerLinkHovered = false;
|
|
61
60
|
this.#render();
|
|
62
61
|
}
|
|
@@ -72,7 +71,7 @@ export class QueryContainer extends HTMLElement {
|
|
|
72
71
|
classesToDisplay = this.#container.getAttribute('class')?.split(/\s+/).filter(Boolean);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
const nodeTitle = this.#queryName || this.#container.
|
|
74
|
+
const nodeTitle = this.#queryName || this.#container.nodeNameInCorrectCase();
|
|
76
75
|
|
|
77
76
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
78
77
|
// clang-format off
|
|
@@ -14,7 +14,6 @@ import * as CSSVariableValueView from './CSSVariableValueView.js';
|
|
|
14
14
|
import * as ElementsBreadcrumbs from './ElementsBreadcrumbs.js';
|
|
15
15
|
import * as ElementsBreadcrumbsUtils from './ElementsBreadcrumbsUtils.js';
|
|
16
16
|
import * as ElementsTreeExpandButton from './ElementsTreeExpandButton.js';
|
|
17
|
-
import * as Helper from './Helper.js';
|
|
18
17
|
import * as QueryContainer from './QueryContainer.js';
|
|
19
18
|
import * as StylePropertyEditor from './StylePropertyEditor.js';
|
|
20
19
|
|
|
@@ -31,7 +30,6 @@ export {
|
|
|
31
30
|
ElementsBreadcrumbs,
|
|
32
31
|
ElementsBreadcrumbsUtils,
|
|
33
32
|
ElementsTreeExpandButton,
|
|
34
|
-
Helper,
|
|
35
33
|
QueryContainer,
|
|
36
34
|
StylePropertyEditor,
|
|
37
35
|
};
|
|
@@ -39,7 +39,7 @@ export interface MediaQueryMarker {
|
|
|
39
39
|
locations: SDK.CSSModel.CSSLocation[];
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export const DEFAULT_VIEW = (input: ViewInput, _output: object, target:
|
|
42
|
+
export const DEFAULT_VIEW = (input: ViewInput, _output: object, target: DocumentFragment): void => {
|
|
43
43
|
const createBarClassMap = (marker: MediaQueryMarker): Record<string, boolean> => ({
|
|
44
44
|
'media-inspector-bar': true,
|
|
45
45
|
'media-inspector-marker-inactive': !marker.active,
|
|
@@ -65,7 +65,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: object, target: HTMLElem
|
|
|
65
65
|
`)}
|
|
66
66
|
</div>
|
|
67
67
|
`).toArray()}
|
|
68
|
-
</div>`, target);
|
|
68
|
+
</div>`, target, {container: {attributes: {jslog: `${VisualLogging.mediaInspectorView().track({click: true})}`}}});
|
|
69
69
|
// clang-format on
|
|
70
70
|
};
|
|
71
71
|
|
|
@@ -155,7 +155,7 @@ function renderLabel(
|
|
|
155
155
|
// clang-format on
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
export class MediaQueryInspector extends UI.Widget.Widget implements
|
|
158
|
+
export class MediaQueryInspector extends UI.Widget.Widget<ShadowRoot> implements
|
|
159
159
|
SDK.TargetManager.SDKModelObserver<SDK.CSSModel.CSSModel> {
|
|
160
160
|
private readonly view: typeof DEFAULT_VIEW;
|
|
161
161
|
private readonly mediaThrottler: Common.Throttler.Throttler;
|
|
@@ -168,10 +168,7 @@ export class MediaQueryInspector extends UI.Widget.Widget implements
|
|
|
168
168
|
constructor(
|
|
169
169
|
getWidthCallback: () => number, setWidthCallback: (arg0: number) => void,
|
|
170
170
|
mediaThrottler: Common.Throttler.Throttler, view = DEFAULT_VIEW) {
|
|
171
|
-
super({
|
|
172
|
-
jslog: `${VisualLogging.mediaInspectorView().track({click: true})}`,
|
|
173
|
-
useShadowDom: true,
|
|
174
|
-
});
|
|
171
|
+
super({useShadowDom: 'pure'});
|
|
175
172
|
this.view = view;
|
|
176
173
|
this.mediaThrottler = mediaThrottler;
|
|
177
174
|
|