chrome-devtools-frontend 1.0.945329 → 1.0.946351
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 -5
- package/config/gni/devtools_grd_files.gni +1 -33
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/circled_exclamation_icon.svg +3 -0
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/i18n/locales/en-US.json +12 -12
- package/front_end/core/i18n/locales/en-XL.json +12 -12
- package/front_end/core/root/Runtime.ts +0 -1
- package/front_end/core/sdk/CSSMetadata.ts +0 -1
- package/front_end/core/sdk/CSSProperty.ts +16 -9
- package/front_end/core/sdk/sdk-meta.ts +20 -8
- package/front_end/devtools_compatibility.js +0 -7
- package/front_end/entrypoints/devtools_app/devtools_app.js +3 -0
- package/front_end/entrypoints/devtools_app/devtools_app.json +1 -2
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +1 -3
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -2
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +0 -120
- package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -11
- package/front_end/entrypoints/formatter_worker/formatter_worker.ts +5 -0
- package/front_end/entrypoints/js_app/js_app.js +3 -0
- package/front_end/entrypoints/js_app/js_app.json +1 -2
- package/front_end/entrypoints/main/MainImpl.ts +0 -6
- package/front_end/entrypoints/ndb_app/ndb_app.js +3 -0
- package/front_end/entrypoints/ndb_app/ndb_app.json +1 -2
- package/front_end/entrypoints/node_app/node_app.js +3 -0
- package/front_end/entrypoints/node_app/node_app.json +1 -2
- package/front_end/entrypoints/shell/shell.js +18 -1
- package/front_end/entrypoints/worker_app/worker_app.js +3 -0
- package/front_end/entrypoints/worker_app/worker_app.json +1 -2
- package/front_end/generated/protocol.d.ts +0 -4
- package/front_end/legacy_test_runner/sources_test_runner/sources_test_runner.js +0 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
- package/front_end/models/bindings/ResourceMapping.ts +1 -1
- package/front_end/models/emulation/EmulatedDevices.ts +2 -4
- package/front_end/models/formatter/FormatterWorkerPool.ts +0 -18
- package/front_end/models/text_utils/CodeMirrorUtils.ts +6 -51
- package/front_end/models/text_utils/TextUtils.ts +1 -2
- package/front_end/models/text_utils/text_utils-legacy.ts +0 -5
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
- package/front_end/panels/application/BackForwardCacheView.ts +8 -1
- package/front_end/panels/elements/StyleEditorWidget.ts +13 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -12
- package/front_end/panels/elements/StylesSidebarPane.ts +35 -9
- package/front_end/panels/elements/elementsTreeOutline.css +0 -13
- package/front_end/panels/network/NetworkConfigView.ts +10 -0
- package/front_end/panels/network/NetworkItemView.ts +10 -1
- package/front_end/panels/network/networkConfigView.css +5 -0
- package/front_end/panels/profiler/heapProfiler.css +2 -5
- package/front_end/panels/profiler/profilesPanel.css +1 -1
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +6 -4
- package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -12
- package/front_end/panels/sources/DebuggerPlugin.ts +6 -2
- package/front_end/panels/sources/sourcesView.css +0 -130
- package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
- package/front_end/third_party/codemirror/codemirror-tsconfig.json +1 -25
- package/front_end/ui/components/adorners/Adorner.ts +14 -14
- package/front_end/ui/components/buttons/Button.ts +133 -42
- package/front_end/ui/components/buttons/button.css +31 -0
- package/front_end/ui/components/data_grid/DataGrid.ts +131 -122
- package/front_end/ui/components/data_grid/DataGridController.ts +42 -42
- package/front_end/ui/components/diff_view/DiffView.ts +4 -4
- package/front_end/ui/components/docs/button/basic.html +3 -0
- package/front_end/ui/components/docs/button/basic.ts +58 -0
- package/front_end/ui/components/expandable_list/ExpandableList.ts +11 -11
- package/front_end/ui/components/icon_button/Icon.ts +24 -21
- package/front_end/ui/components/icon_button/IconButton.ts +31 -31
- package/front_end/ui/components/issue_counter/IssueCounter.ts +52 -52
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +42 -42
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +67 -67
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +22 -22
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +36 -36
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +19 -19
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +24 -32
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +52 -52
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +21 -21
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +14 -14
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +8 -8
- package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -6
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +33 -33
- package/front_end/ui/components/report_view/ReportView.ts +18 -18
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +53 -53
- package/front_end/ui/components/settings/SettingCheckbox.ts +15 -15
- package/front_end/ui/components/survey_link/SurveyLink.ts +28 -28
- package/front_end/ui/components/text_editor/TextEditor.ts +55 -52
- package/front_end/ui/components/text_editor/config.ts +3 -3
- package/front_end/ui/components/text_editor/javascript.ts +27 -9
- package/front_end/ui/components/text_editor/theme.ts +1 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +19 -19
- package/front_end/ui/components/tree_outline/TreeOutline.ts +56 -56
- package/front_end/ui/legacy/Infobar.ts +9 -0
- package/front_end/ui/legacy/ListWidget.ts +2 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -3
- package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +0 -1
- package/front_end/ui/legacy/components/object_ui/object_ui-legacy.ts +0 -8
- package/front_end/ui/legacy/components/object_ui/object_ui.ts +0 -4
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -0
- package/front_end/ui/legacy/inspectorSyntaxHighlight.css +0 -211
- package/front_end/ui/legacy/legacy-legacy.ts +0 -6
- package/front_end/ui/legacy/legacy.ts +0 -2
- package/front_end/ui/legacy/tabbedPane.css +1 -1
- package/inspector_overlay/main.ts +12 -2
- package/package.json +1 -1
- package/scripts/check_gn.js +1 -1
- package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
- package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
- package/scripts/hosted_mode/server.js +17 -2
- package/front_end/entrypoints/shell/shell-meta-files.ts +0 -22
- package/front_end/entrypoints/shell/shell.json +0 -5
- package/front_end/ui/legacy/TextEditor.ts +0 -82
- package/front_end/ui/legacy/components/object_ui/JavaScriptAutocomplete.ts +0 -836
- package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +0 -1676
- package/front_end/ui/legacy/components/text_editor/TextEditorAutocompleteController.ts +0 -586
- package/front_end/ui/legacy/components/text_editor/autocompleteTooltip.css +0 -20
- package/front_end/ui/legacy/components/text_editor/cm_modes.ts +0 -23
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +0 -995
- package/front_end/ui/legacy/components/text_editor/module.json +0 -7
- package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -33
- package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -13
|
@@ -82,20 +82,20 @@ export const enum FilterOption {
|
|
|
82
82
|
|
|
83
83
|
export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
84
84
|
static readonly litTagName = LitHtml.literal`devtools-tree-outline`;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
86
|
+
#treeData: readonly TreeNode<TreeNodeDataType>[] = [];
|
|
87
|
+
#nodeExpandedMap: Map<string, boolean> = new Map();
|
|
88
|
+
#domNodeToTreeNodeMap: WeakMap<HTMLLIElement, TreeNode<TreeNodeDataType>> = new WeakMap();
|
|
89
|
+
#hasRenderedAtLeastOnce = false;
|
|
90
90
|
/**
|
|
91
91
|
* If we have expanded to a certain node, we want to focus it once we've
|
|
92
92
|
* rendered. But we render lazily and wrapped in LitHtml.until, so we can't
|
|
93
93
|
* know for sure when that node will be rendered. This variable tracks the
|
|
94
94
|
* node that we want focused but may not yet have been rendered.
|
|
95
95
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
#nodeIdPendingFocus: TreeNodeId|null = null;
|
|
97
|
+
#selectedTreeNode: TreeNode<TreeNodeDataType>|null = null;
|
|
98
|
+
#defaultRenderer =
|
|
99
99
|
(node: TreeNode<TreeNodeDataType>, _state: {isExpanded: boolean}): LitHtml.TemplateResult => {
|
|
100
100
|
if (typeof node.treeNodeData !== 'string') {
|
|
101
101
|
console.warn(`The default TreeOutline renderer simply stringifies its given value. You passed in ${
|
|
@@ -105,16 +105,16 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
105
105
|
}
|
|
106
106
|
return LitHtml.html`${String(node.treeNodeData)}`;
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
#nodeFilter?: ((node: TreeNodeDataType) => FilterOption);
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* scheduledRender = render() has been called and scheduled a render.
|
|
112
112
|
*/
|
|
113
|
-
|
|
113
|
+
#scheduledRender = false;
|
|
114
114
|
/**
|
|
115
115
|
* enqueuedRender = render() was called mid-way through an existing render.
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
#enqueuedRender = false;
|
|
118
118
|
|
|
119
119
|
static get observedAttributes(): string[] {
|
|
120
120
|
return ['nowrap', 'toplevelbordercolor'];
|
|
@@ -136,22 +136,22 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
136
136
|
connectedCallback(): void {
|
|
137
137
|
this.setTopLevelNodeBorderColorCSSVariable(this.getAttribute('toplevelbordercolor'));
|
|
138
138
|
this.setNodeKeyNoWrapCSSVariable(this.getAttribute('nowrap'));
|
|
139
|
-
this
|
|
139
|
+
this.#shadow.adoptedStyleSheets = [treeOutlineStyles, CodeHighlighter.Style.default];
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
get data(): TreeOutlineData<TreeNodeDataType> {
|
|
143
143
|
return {
|
|
144
|
-
tree: this
|
|
145
|
-
defaultRenderer: this
|
|
144
|
+
tree: this.#treeData as TreeNode<TreeNodeDataType>[],
|
|
145
|
+
defaultRenderer: this.#defaultRenderer,
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
set data(data: TreeOutlineData<TreeNodeDataType>) {
|
|
150
|
-
this
|
|
151
|
-
this
|
|
152
|
-
this
|
|
153
|
-
if (!this
|
|
154
|
-
this
|
|
150
|
+
this.#defaultRenderer = data.defaultRenderer;
|
|
151
|
+
this.#treeData = data.tree;
|
|
152
|
+
this.#nodeFilter = data.filter;
|
|
153
|
+
if (!this.#hasRenderedAtLeastOnce) {
|
|
154
|
+
this.#selectedTreeNode = this.#treeData[0];
|
|
155
155
|
}
|
|
156
156
|
this.render();
|
|
157
157
|
}
|
|
@@ -162,7 +162,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
162
162
|
* 1 and 2.
|
|
163
163
|
*/
|
|
164
164
|
async expandRecursively(maxDepth = 2): Promise<void> {
|
|
165
|
-
await Promise.all(this
|
|
165
|
+
await Promise.all(this.#treeData.map(rootNode => this.expandAndRecurse(rootNode, 0, maxDepth)));
|
|
166
166
|
await this.render();
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -170,7 +170,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
170
170
|
* Collapses all nodes in the tree.
|
|
171
171
|
*/
|
|
172
172
|
async collapseAllNodes(): Promise<void> {
|
|
173
|
-
this
|
|
173
|
+
this.#nodeExpandedMap.clear();
|
|
174
174
|
await this.render();
|
|
175
175
|
}
|
|
176
176
|
|
|
@@ -185,7 +185,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
185
185
|
* Takes a TreeNode ID, expands the outline to reveal it, and focuses it.
|
|
186
186
|
*/
|
|
187
187
|
async expandToAndSelectTreeNodeId(targetTreeNodeId: TreeNodeId): Promise<void> {
|
|
188
|
-
const pathToTreeNode = await getPathToTreeNode(this
|
|
188
|
+
const pathToTreeNode = await getPathToTreeNode(this.#treeData, targetTreeNodeId);
|
|
189
189
|
|
|
190
190
|
if (pathToTreeNode === null) {
|
|
191
191
|
throw new Error(`Could not find node with id ${targetTreeNodeId} in the tree.`);
|
|
@@ -198,7 +198,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
// Mark the node as pending focus so when it is rendered into the DOM we can focus it
|
|
201
|
-
this
|
|
201
|
+
this.#nodeIdPendingFocus = targetTreeNodeId;
|
|
202
202
|
await this.render();
|
|
203
203
|
}
|
|
204
204
|
|
|
@@ -206,7 +206,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
206
206
|
* Takes a list of TreeNode IDs and expands the corresponding nodes.
|
|
207
207
|
*/
|
|
208
208
|
expandNodeIds(nodeIds: TreeNodeId[]): Promise<void> {
|
|
209
|
-
nodeIds.forEach(id => this
|
|
209
|
+
nodeIds.forEach(id => this.#nodeExpandedMap.set(id, true));
|
|
210
210
|
return this.render();
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -214,12 +214,12 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
214
214
|
* Takes a TreeNode ID and focuses the corresponding node.
|
|
215
215
|
*/
|
|
216
216
|
focusNodeId(nodeId: TreeNodeId): Promise<void> {
|
|
217
|
-
this
|
|
217
|
+
this.#nodeIdPendingFocus = nodeId;
|
|
218
218
|
return this.render();
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
async collapseChildrenOfNode(domNode: HTMLLIElement): Promise<void> {
|
|
222
|
-
const treeNode = this
|
|
222
|
+
const treeNode = this.#domNodeToTreeNodeMap.get(domNode);
|
|
223
223
|
if (!treeNode) {
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
@@ -248,22 +248,22 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
private getSelectedTreeNode(): TreeNode<TreeNodeDataType> {
|
|
251
|
-
if (!this
|
|
251
|
+
if (!this.#selectedTreeNode) {
|
|
252
252
|
throw new Error('getSelectedNode was called but selectedTreeNode is null');
|
|
253
253
|
}
|
|
254
|
-
return this
|
|
254
|
+
return this.#selectedTreeNode;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
private async fetchNodeChildren(node: TreeNodeWithChildren<TreeNodeDataType>): Promise<TreeNode<TreeNodeDataType>[]> {
|
|
258
258
|
const children = await getNodeChildren(node);
|
|
259
|
-
if (!this
|
|
259
|
+
if (!this.#nodeFilter) {
|
|
260
260
|
return children;
|
|
261
261
|
}
|
|
262
262
|
const filteredChildren = [];
|
|
263
263
|
for (const child of children) {
|
|
264
|
-
const filtering = this
|
|
264
|
+
const filtering = this.#nodeFilter(child.treeNodeData);
|
|
265
265
|
// We always include the selected node in the tree, regardless of its filtering status.
|
|
266
|
-
if (filtering === FilterOption.SHOW || this.isSelectedNode(child) || child.id === this
|
|
266
|
+
if (filtering === FilterOption.SHOW || this.isSelectedNode(child) || child.id === this.#nodeIdPendingFocus) {
|
|
267
267
|
filteredChildren.push(child);
|
|
268
268
|
} else if (filtering === FilterOption.FLATTEN && isExpandableNode(child)) {
|
|
269
269
|
const grandChildren = await this.fetchNodeChildren(child);
|
|
@@ -274,11 +274,11 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
private setNodeExpandedState(node: TreeNode<TreeNodeDataType>, newExpandedState: boolean): void {
|
|
277
|
-
this
|
|
277
|
+
this.#nodeExpandedMap.set(node.id, newExpandedState);
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
private nodeIsExpanded(node: TreeNode<TreeNodeDataType>): boolean {
|
|
281
|
-
return this
|
|
281
|
+
return this.#nodeExpandedMap.get(node.id) || false;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
private async expandAndRecurse(node: TreeNode<TreeNodeDataType>, currentDepth: number, maxDepth: number):
|
|
@@ -309,7 +309,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
309
309
|
event.stopPropagation();
|
|
310
310
|
const nodeClickExpandsOrContracts = this.getAttribute('clickabletitle') !== null;
|
|
311
311
|
const domNode = event.currentTarget as HTMLLIElement;
|
|
312
|
-
const node = this
|
|
312
|
+
const node = this.#domNodeToTreeNodeMap.get(domNode);
|
|
313
313
|
if (nodeClickExpandsOrContracts && node && isExpandableNode(node)) {
|
|
314
314
|
this.setNodeExpandedState(node, !this.nodeIsExpanded(node));
|
|
315
315
|
}
|
|
@@ -317,11 +317,11 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
private async focusTreeNode(domNode: HTMLLIElement): Promise<void> {
|
|
320
|
-
const treeNode = this
|
|
320
|
+
const treeNode = this.#domNodeToTreeNodeMap.get(domNode);
|
|
321
321
|
if (!treeNode) {
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
|
-
this
|
|
324
|
+
this.#selectedTreeNode = treeNode;
|
|
325
325
|
await this.render();
|
|
326
326
|
this.dispatchEvent(new ItemSelectedEvent(treeNode));
|
|
327
327
|
coordinator.write('DOMNode focus', () => {
|
|
@@ -331,7 +331,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
331
331
|
|
|
332
332
|
private processHomeAndEndKeysNavigation(key: 'Home'|'End'): void {
|
|
333
333
|
if (key === 'Home') {
|
|
334
|
-
const firstRootNode = this
|
|
334
|
+
const firstRootNode = this.#shadow.querySelector<HTMLLIElement>('ul[role="tree"] > li[role="treeitem"]');
|
|
335
335
|
if (firstRootNode) {
|
|
336
336
|
this.focusTreeNode(firstRootNode);
|
|
337
337
|
}
|
|
@@ -345,7 +345,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
345
345
|
* li[role="treeitem"] in the DOM because we only render visible nodes.
|
|
346
346
|
* Therefore we can select all the nodes and pick the last one.
|
|
347
347
|
*/
|
|
348
|
-
const allTreeItems = this
|
|
348
|
+
const allTreeItems = this.#shadow.querySelectorAll<HTMLLIElement>('li[role="treeitem"]');
|
|
349
349
|
const lastTreeItem = allTreeItems[allTreeItems.length - 1];
|
|
350
350
|
if (lastTreeItem) {
|
|
351
351
|
this.focusTreeNode(lastTreeItem);
|
|
@@ -355,7 +355,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
355
355
|
|
|
356
356
|
private async processArrowKeyNavigation(key: Platform.KeyboardUtilities.ArrowKey, currentDOMNode: HTMLLIElement):
|
|
357
357
|
Promise<void> {
|
|
358
|
-
const currentTreeNode = this
|
|
358
|
+
const currentTreeNode = this.#domNodeToTreeNodeMap.get(currentDOMNode);
|
|
359
359
|
if (!currentTreeNode) {
|
|
360
360
|
return;
|
|
361
361
|
}
|
|
@@ -370,7 +370,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
private processEnterOrSpaceNavigation(currentDOMNode: HTMLLIElement): void {
|
|
373
|
-
const currentTreeNode = this
|
|
373
|
+
const currentTreeNode = this.#domNodeToTreeNodeMap.get(currentDOMNode);
|
|
374
374
|
if (!currentTreeNode) {
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
@@ -399,13 +399,13 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
private focusPendingNode(domNode: HTMLLIElement): void {
|
|
402
|
-
this
|
|
402
|
+
this.#nodeIdPendingFocus = null;
|
|
403
403
|
this.focusTreeNode(domNode);
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
private isSelectedNode(node: TreeNode<TreeNodeDataType>): boolean {
|
|
407
|
-
if (this
|
|
408
|
-
return node.id === this
|
|
407
|
+
if (this.#selectedTreeNode) {
|
|
408
|
+
return node.id === this.#selectedTreeNode.id;
|
|
409
409
|
}
|
|
410
410
|
return false;
|
|
411
411
|
}
|
|
@@ -446,7 +446,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
446
446
|
if (node.renderer) {
|
|
447
447
|
renderedNodeKey = node.renderer(node, {isExpanded: nodeIsExpanded});
|
|
448
448
|
} else {
|
|
449
|
-
renderedNodeKey = this
|
|
449
|
+
renderedNodeKey = this.#defaultRenderer(node, {isExpanded: nodeIsExpanded});
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
@@ -460,7 +460,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
460
460
|
aria-posinset=${positionInSet + 1}
|
|
461
461
|
class=${listItemClasses}
|
|
462
462
|
@click=${this.onNodeClick}
|
|
463
|
-
track-dom-node-to-tree-node=${trackDOMNodeToTreeNode(this
|
|
463
|
+
track-dom-node-to-tree-node=${trackDOMNodeToTreeNode(this.#domNodeToTreeNodeMap, node)}
|
|
464
464
|
on-render=${ComponentHelpers.Directives.nodeRenderedCallback(domNode => {
|
|
465
465
|
/**
|
|
466
466
|
* Because TreeNodes are lazily rendered, you can call
|
|
@@ -473,7 +473,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
473
473
|
return;
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
if (this
|
|
476
|
+
if (this.#nodeIdPendingFocus && node.id === this.#nodeIdPendingFocus) {
|
|
477
477
|
this.focusPendingNode(domNode);
|
|
478
478
|
}
|
|
479
479
|
})}
|
|
@@ -497,14 +497,14 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
private async render(): Promise<void> {
|
|
500
|
-
if (this
|
|
500
|
+
if (this.#scheduledRender) {
|
|
501
501
|
// If we are already rendering, don't render again immediately, but
|
|
502
502
|
// enqueue it to be run after we're done on our current render.
|
|
503
|
-
this
|
|
503
|
+
this.#enqueuedRender = true;
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
506
|
|
|
507
|
-
this
|
|
507
|
+
this.#scheduledRender = true;
|
|
508
508
|
|
|
509
509
|
await coordinator.write('TreeOutline render', () => {
|
|
510
510
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
@@ -512,27 +512,27 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
|
|
|
512
512
|
LitHtml.render(LitHtml.html`
|
|
513
513
|
<div class="wrapping-container">
|
|
514
514
|
<ul role="tree" @keydown=${this.onTreeKeyDown}>
|
|
515
|
-
${this
|
|
515
|
+
${this.#treeData.map((topLevelNode, index) => {
|
|
516
516
|
return this.renderNode(topLevelNode, {
|
|
517
517
|
depth: 0,
|
|
518
|
-
setSize: this
|
|
518
|
+
setSize: this.#treeData.length,
|
|
519
519
|
positionInSet: index,
|
|
520
520
|
});
|
|
521
521
|
})}
|
|
522
522
|
</ul>
|
|
523
523
|
</div>
|
|
524
|
-
`, this
|
|
524
|
+
`, this.#shadow, {
|
|
525
525
|
host: this,
|
|
526
526
|
});
|
|
527
527
|
});
|
|
528
528
|
// clang-format on
|
|
529
|
-
this
|
|
530
|
-
this
|
|
529
|
+
this.#hasRenderedAtLeastOnce = true;
|
|
530
|
+
this.#scheduledRender = false;
|
|
531
531
|
|
|
532
532
|
// If render() was called when we were already mid-render, let's re-render
|
|
533
533
|
// to ensure we're not rendering any stale UI.
|
|
534
|
-
if (this
|
|
535
|
-
this
|
|
534
|
+
if (this.#enqueuedRender) {
|
|
535
|
+
this.#enqueuedRender = false;
|
|
536
536
|
return this.render();
|
|
537
537
|
}
|
|
538
538
|
}
|
|
@@ -48,6 +48,7 @@ export class Infobar {
|
|
|
48
48
|
private readonly toggleElement: HTMLButtonElement;
|
|
49
49
|
private readonly closeButton: HTMLElement;
|
|
50
50
|
private closeCallback: (() => void)|null;
|
|
51
|
+
#firstFocusableElement: HTMLElement|null = null;
|
|
51
52
|
private parentView?: Widget;
|
|
52
53
|
|
|
53
54
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
@@ -88,6 +89,9 @@ export class Infobar {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
const button = createTextButton(action.text, actionCallback, buttonClass);
|
|
92
|
+
if (action.highlight && !this.#firstFocusableElement) {
|
|
93
|
+
this.#firstFocusableElement = button;
|
|
94
|
+
}
|
|
91
95
|
this.actionContainer.appendChild(button);
|
|
92
96
|
}
|
|
93
97
|
}
|
|
@@ -202,6 +206,11 @@ export class Infobar {
|
|
|
202
206
|
this.toggleElement.remove();
|
|
203
207
|
this.onResize();
|
|
204
208
|
ARIAUtils.alert(this.detailsMessage);
|
|
209
|
+
if (this.#firstFocusableElement) {
|
|
210
|
+
this.#firstFocusableElement.focus();
|
|
211
|
+
} else {
|
|
212
|
+
this.closeButton.focus();
|
|
213
|
+
}
|
|
205
214
|
}
|
|
206
215
|
|
|
207
216
|
createDetailsRowMessage(message?: string): Element {
|
|
@@ -276,10 +276,10 @@ export class Editor<T> {
|
|
|
276
276
|
this.element = document.createElement('div');
|
|
277
277
|
this.element.classList.add('editor-container');
|
|
278
278
|
this.element.addEventListener('keydown', onKeyDown.bind(null, isEscKey, this.cancelClicked.bind(this)), false);
|
|
279
|
-
this.element.addEventListener(
|
|
280
|
-
'keydown', onKeyDown.bind(null, event => event.key === 'Enter', this.commitClicked.bind(this)), false);
|
|
281
279
|
|
|
282
280
|
this.contentElementInternal = this.element.createChild('div', 'editor-content');
|
|
281
|
+
this.contentElementInternal.addEventListener(
|
|
282
|
+
'keydown', onKeyDown.bind(null, event => event.key === 'Enter', this.commitClicked.bind(this)), false);
|
|
283
283
|
|
|
284
284
|
const buttonsRow = this.element.createChild('div', 'editor-buttons');
|
|
285
285
|
this.commitButton = createTextButton('', this.commitClicked.bind(this), '', true /* primary */);
|
|
@@ -37,10 +37,10 @@ import * as Platform from '../../../../core/platform/platform.js';
|
|
|
37
37
|
import * as SDK from '../../../../core/sdk/sdk.js';
|
|
38
38
|
import * as TextUtils from '../../../../models/text_utils/text_utils.js';
|
|
39
39
|
import * as IconButton from '../../../components/icon_button/icon_button.js';
|
|
40
|
+
import * as TextEditor from '../../../components/text_editor/text_editor.js';
|
|
40
41
|
import * as UI from '../../legacy.js';
|
|
41
42
|
|
|
42
43
|
import {CustomPreviewComponent} from './CustomPreviewComponent.js';
|
|
43
|
-
import {JavaScriptAutocomplete} from './JavaScriptAutocomplete.js';
|
|
44
44
|
import {JavaScriptREPL} from './JavaScriptREPL.js';
|
|
45
45
|
import {createSpansForNodeTitle, RemoteObjectPreviewFormatter} from './RemoteObjectPreviewFormatter.js';
|
|
46
46
|
import objectValueStyles from './objectValue.css.js';
|
|
@@ -1513,8 +1513,7 @@ export class ArrayGroupingTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1513
1513
|
export class ObjectPropertyPrompt extends UI.TextPrompt.TextPrompt {
|
|
1514
1514
|
constructor() {
|
|
1515
1515
|
super();
|
|
1516
|
-
|
|
1517
|
-
this.initialize(javaScriptAutocomplete.completionsForTextInCurrentContext.bind(javaScriptAutocomplete));
|
|
1516
|
+
this.initialize(TextEditor.JavaScript.completeInContext);
|
|
1518
1517
|
}
|
|
1519
1518
|
}
|
|
1520
1519
|
|
|
@@ -12,14 +12,6 @@ ObjectUI = ObjectUI || {};
|
|
|
12
12
|
/** @constructor */
|
|
13
13
|
ObjectUI.CustomPreviewComponent = ObjectUIModule.CustomPreviewComponent.CustomPreviewComponent;
|
|
14
14
|
|
|
15
|
-
/** @constructor */
|
|
16
|
-
ObjectUI.JavaScriptAutocomplete = ObjectUIModule.JavaScriptAutocomplete.JavaScriptAutocomplete;
|
|
17
|
-
|
|
18
|
-
/** @constructor */
|
|
19
|
-
ObjectUI.JavaScriptAutocompleteConfig = ObjectUIModule.JavaScriptAutocomplete.JavaScriptAutocompleteConfig;
|
|
20
|
-
|
|
21
|
-
ObjectUI.javaScriptAutocomplete = ObjectUIModule.javaScriptAutocomplete;
|
|
22
|
-
|
|
23
15
|
/** @constructor */
|
|
24
16
|
ObjectUI.JavaScriptREPL = ObjectUIModule.JavaScriptREPL.JavaScriptREPL;
|
|
25
17
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as CustomPreviewComponent from './CustomPreviewComponent.js';
|
|
6
|
-
import * as JavaScriptAutocomplete from './JavaScriptAutocomplete.js';
|
|
7
6
|
import * as JavaScriptREPL from './JavaScriptREPL.js';
|
|
8
7
|
import * as ObjectPopoverHelper from './ObjectPopoverHelper.js';
|
|
9
8
|
import * as ObjectPropertiesSection from './ObjectPropertiesSection.js';
|
|
@@ -11,11 +10,8 @@ import * as RemoteObjectPreviewFormatter from './RemoteObjectPreviewFormatter.js
|
|
|
11
10
|
|
|
12
11
|
export {
|
|
13
12
|
CustomPreviewComponent,
|
|
14
|
-
JavaScriptAutocomplete,
|
|
15
13
|
JavaScriptREPL,
|
|
16
14
|
ObjectPopoverHelper,
|
|
17
15
|
ObjectPropertiesSection,
|
|
18
16
|
RemoteObjectPreviewFormatter,
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
export const javaScriptAutocomplete = JavaScriptAutocomplete.JavaScriptAutocomplete.instance();
|
|
@@ -229,6 +229,9 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
|
229
229
|
},
|
|
230
230
|
},
|
|
231
231
|
},
|
|
232
|
+
':host-context(.pretty-printed) & .cm-lineNumbers .cm-gutterElement': {
|
|
233
|
+
color: 'var(--legacy-accent-color)',
|
|
234
|
+
},
|
|
232
235
|
}),
|
|
233
236
|
CodeMirror.EditorView.domEventHandlers({
|
|
234
237
|
focus: () => this.onFocus(),
|