chrome-devtools-frontend 1.0.957983 → 1.0.958475
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/.eslintignore +0 -1
- package/front_end/models/persistence/Automapping.ts +32 -4
- package/front_end/models/persistence/PersistenceImpl.ts +33 -13
- package/front_end/panels/elements/AccessibilityTreeView.ts +2 -2
- package/front_end/panels/elements/ElementsPanel.ts +16 -15
- package/front_end/panels/elements/elementsPanel.css +4 -2
- package/front_end/panels/sources/sources-meta.ts +14 -11
- package/front_end/ui/components/buttons/Button.ts +5 -1
- package/front_end/ui/components/buttons/button.css +10 -1
- package/front_end/ui/legacy/toolbar.css +2 -0
- package/package.json +1 -1
package/.eslintignore
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
|
+
import * as Host from '../../core/host/host.js';
|
|
6
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
8
|
import * as Platform from '../../core/platform/platform.js';
|
|
8
9
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
@@ -28,7 +29,7 @@ export class Automapping {
|
|
|
28
29
|
private readonly onStatusAdded: (arg0: AutomappingStatus) => Promise<void>;
|
|
29
30
|
private readonly onStatusRemoved: (arg0: AutomappingStatus) => Promise<void>;
|
|
30
31
|
private readonly statuses: Set<AutomappingStatus>;
|
|
31
|
-
private readonly fileSystemUISourceCodes:
|
|
32
|
+
private readonly fileSystemUISourceCodes: FileSystemUISourceCodes;
|
|
32
33
|
private readonly sweepThrottler: Common.Throttler.Throttler;
|
|
33
34
|
private readonly sourceCodeToProcessingPromiseMap: WeakMap<Workspace.UISourceCode.UISourceCode, Promise<void>>;
|
|
34
35
|
private readonly sourceCodeToAutoMappingStatusMap: WeakMap<Workspace.UISourceCode.UISourceCode, AutomappingStatus>;
|
|
@@ -47,7 +48,7 @@ export class Automapping {
|
|
|
47
48
|
this.onStatusRemoved = onStatusRemoved;
|
|
48
49
|
this.statuses = new Set();
|
|
49
50
|
|
|
50
|
-
this.fileSystemUISourceCodes = new
|
|
51
|
+
this.fileSystemUISourceCodes = new FileSystemUISourceCodes();
|
|
51
52
|
this.sweepThrottler = new Common.Throttler.Throttler(100);
|
|
52
53
|
|
|
53
54
|
this.sourceCodeToProcessingPromiseMap = new WeakMap();
|
|
@@ -144,7 +145,7 @@ export class Automapping {
|
|
|
144
145
|
return;
|
|
145
146
|
}
|
|
146
147
|
this.filesIndex.addPath(uiSourceCode.url());
|
|
147
|
-
this.fileSystemUISourceCodes.
|
|
148
|
+
this.fileSystemUISourceCodes.add(uiSourceCode);
|
|
148
149
|
this.scheduleSweep();
|
|
149
150
|
} else if (project.type() === Workspace.Workspace.projectTypes.Network) {
|
|
150
151
|
this.computeNetworkStatus(uiSourceCode);
|
|
@@ -179,7 +180,7 @@ export class Automapping {
|
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
this.filesIndex.addPath(uiSourceCode.url());
|
|
182
|
-
this.fileSystemUISourceCodes.
|
|
183
|
+
this.fileSystemUISourceCodes.add(uiSourceCode);
|
|
183
184
|
this.scheduleSweep();
|
|
184
185
|
}
|
|
185
186
|
|
|
@@ -489,6 +490,33 @@ class FolderIndex {
|
|
|
489
490
|
}
|
|
490
491
|
}
|
|
491
492
|
|
|
493
|
+
class FileSystemUISourceCodes {
|
|
494
|
+
private readonly sourceCodes: Map<string, Workspace.UISourceCode.UISourceCode>;
|
|
495
|
+
|
|
496
|
+
constructor() {
|
|
497
|
+
this.sourceCodes = new Map();
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
private getPlatformCanonicalFileUrl(path: string): string {
|
|
501
|
+
return Host.Platform.isWin() ? path.toLowerCase() : path;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
add(sourceCode: Workspace.UISourceCode.UISourceCode): void {
|
|
505
|
+
const fileUrl = this.getPlatformCanonicalFileUrl(sourceCode.url());
|
|
506
|
+
this.sourceCodes.set(fileUrl, sourceCode);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
get(fileUrl: string): Workspace.UISourceCode.UISourceCode|undefined {
|
|
510
|
+
fileUrl = this.getPlatformCanonicalFileUrl(fileUrl);
|
|
511
|
+
return this.sourceCodes.get(fileUrl);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
delete(fileUrl: string): void {
|
|
515
|
+
fileUrl = this.getPlatformCanonicalFileUrl(fileUrl);
|
|
516
|
+
this.sourceCodes.delete(fileUrl);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
492
520
|
export class AutomappingStatus {
|
|
493
521
|
network: Workspace.UISourceCode.UISourceCode;
|
|
494
522
|
fileSystem: Workspace.UISourceCode.UISourceCode;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
|
+
import * as Host from '../../core/host/host.js';
|
|
6
7
|
import * as Platform from '../../core/platform/platform.js';
|
|
7
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
9
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
@@ -18,7 +19,7 @@ let persistenceInstance: PersistenceImpl;
|
|
|
18
19
|
export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
19
20
|
private readonly workspace: Workspace.Workspace.WorkspaceImpl;
|
|
20
21
|
private readonly breakpointManager: Bindings.BreakpointManager.BreakpointManager;
|
|
21
|
-
private readonly filePathPrefixesToBindingCount:
|
|
22
|
+
private readonly filePathPrefixesToBindingCount: FilePathPrefixesBindingCounts;
|
|
22
23
|
private subscribedBindingEventListeners:
|
|
23
24
|
Platform.MapUtilities.Multimap<Workspace.UISourceCode.UISourceCode, () => void>;
|
|
24
25
|
private readonly mapping: Automapping;
|
|
@@ -28,7 +29,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
28
29
|
super();
|
|
29
30
|
this.workspace = workspace;
|
|
30
31
|
this.breakpointManager = breakpointManager;
|
|
31
|
-
this.filePathPrefixesToBindingCount = new
|
|
32
|
+
this.filePathPrefixesToBindingCount = new FilePathPrefixesBindingCounts();
|
|
32
33
|
|
|
33
34
|
this.subscribedBindingEventListeners = new Platform.MapUtilities.Multimap();
|
|
34
35
|
|
|
@@ -92,7 +93,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
92
93
|
binding.fileSystem.addEventListener(
|
|
93
94
|
Workspace.UISourceCode.Events.WorkingCopyChanged, this.onWorkingCopyChanged, this);
|
|
94
95
|
|
|
95
|
-
this.
|
|
96
|
+
this.filePathPrefixesToBindingCount.add(binding.fileSystem.url());
|
|
96
97
|
|
|
97
98
|
await this.moveBreakpoints(binding.fileSystem, binding.network);
|
|
98
99
|
|
|
@@ -131,7 +132,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
131
132
|
binding.fileSystem.removeEventListener(
|
|
132
133
|
Workspace.UISourceCode.Events.WorkingCopyChanged, this.onWorkingCopyChanged, this);
|
|
133
134
|
|
|
134
|
-
this.
|
|
135
|
+
this.filePathPrefixesToBindingCount.remove(binding.fileSystem.url());
|
|
135
136
|
await this.breakpointManager.copyBreakpoints(binding.network.url(), binding.fileSystem);
|
|
136
137
|
|
|
137
138
|
this.notifyBindingEvent(binding.network);
|
|
@@ -307,33 +308,52 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
307
308
|
return binding ? binding.network : null;
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
|
|
311
|
+
filePathHasBindings(filePath: string): boolean {
|
|
312
|
+
return this.filePathPrefixesToBindingCount.hasBindingPrefix(filePath);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
class FilePathPrefixesBindingCounts {
|
|
317
|
+
private prefixCounts: Map<string, number>;
|
|
318
|
+
|
|
319
|
+
constructor() {
|
|
320
|
+
this.prefixCounts = new Map();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
private getPlatformCanonicalFilePath(path: string): string {
|
|
324
|
+
return Host.Platform.isWin() ? path.toLowerCase() : path;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
add(filePath: string): void {
|
|
328
|
+
filePath = this.getPlatformCanonicalFilePath(filePath);
|
|
311
329
|
let relative = '';
|
|
312
330
|
for (const token of filePath.split('/')) {
|
|
313
331
|
relative += token + '/';
|
|
314
|
-
const count = this.
|
|
315
|
-
this.
|
|
332
|
+
const count = this.prefixCounts.get(relative) || 0;
|
|
333
|
+
this.prefixCounts.set(relative, count + 1);
|
|
316
334
|
}
|
|
317
335
|
}
|
|
318
336
|
|
|
319
|
-
|
|
337
|
+
remove(filePath: string): void {
|
|
338
|
+
filePath = this.getPlatformCanonicalFilePath(filePath);
|
|
320
339
|
let relative = '';
|
|
321
340
|
for (const token of filePath.split('/')) {
|
|
322
341
|
relative += token + '/';
|
|
323
|
-
const count = this.
|
|
342
|
+
const count = this.prefixCounts.get(relative);
|
|
324
343
|
if (count === 1) {
|
|
325
|
-
this.
|
|
344
|
+
this.prefixCounts.delete(relative);
|
|
326
345
|
} else if (count !== undefined) {
|
|
327
|
-
this.
|
|
346
|
+
this.prefixCounts.set(relative, count - 1);
|
|
328
347
|
}
|
|
329
348
|
}
|
|
330
349
|
}
|
|
331
350
|
|
|
332
|
-
|
|
351
|
+
hasBindingPrefix(filePath: string): boolean {
|
|
352
|
+
filePath = this.getPlatformCanonicalFilePath(filePath);
|
|
333
353
|
if (!filePath.endsWith('/')) {
|
|
334
354
|
filePath += '/';
|
|
335
355
|
}
|
|
336
|
-
return this.
|
|
356
|
+
return this.prefixCounts.has(filePath);
|
|
337
357
|
}
|
|
338
358
|
}
|
|
339
359
|
|
|
@@ -12,11 +12,11 @@ import {ElementsPanel} from './ElementsPanel.js';
|
|
|
12
12
|
export class AccessibilityTreeView extends UI.Widget.VBox implements
|
|
13
13
|
SDK.TargetManager.SDKModelObserver<SDK.AccessibilityModel.AccessibilityModel> {
|
|
14
14
|
private accessibilityTreeComponent = new TreeOutline.TreeOutline.TreeOutline<AccessibilityTreeUtils.AXTreeNodeData>();
|
|
15
|
-
private readonly toggleButton:
|
|
15
|
+
private readonly toggleButton: HTMLElement;
|
|
16
16
|
private inspectedDOMNode: SDK.DOMModel.DOMNode|null = null;
|
|
17
17
|
private root: SDK.AccessibilityModel.AccessibilityNode|null = null;
|
|
18
18
|
|
|
19
|
-
constructor(toggleButton:
|
|
19
|
+
constructor(toggleButton: HTMLElement) {
|
|
20
20
|
super();
|
|
21
21
|
// toggleButton is bound to a click handler on ElementsPanel to switch between the DOM tree
|
|
22
22
|
// and accessibility tree views.
|
|
@@ -42,7 +42,7 @@ import * as Extensions from '../../models/extensions/extensions.js';
|
|
|
42
42
|
import elementsPanelStyles from './elementsPanel.css.js';
|
|
43
43
|
|
|
44
44
|
import type * as Adorners from '../../ui/components/adorners/adorners.js';
|
|
45
|
-
import * as
|
|
45
|
+
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
46
46
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
47
47
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
48
48
|
|
|
@@ -142,20 +142,21 @@ const UIStrings = {
|
|
|
142
142
|
const str_ = i18n.i18n.registerUIStrings('panels/elements/ElementsPanel.ts', UIStrings);
|
|
143
143
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
144
144
|
|
|
145
|
-
const createAccessibilityTreeToggleButton = (isActive: boolean):
|
|
146
|
-
const button =
|
|
145
|
+
const createAccessibilityTreeToggleButton = (isActive: boolean): HTMLElement => {
|
|
146
|
+
const button = new Buttons.Button.Button();
|
|
147
|
+
const title =
|
|
148
|
+
isActive ? i18nString(UIStrings.switchToDomTreeView) : i18nString(UIStrings.switchToAccessibilityTreeView);
|
|
149
|
+
button.data = {
|
|
150
|
+
active: isActive,
|
|
151
|
+
variant: Buttons.Button.Variant.TOOLBAR,
|
|
152
|
+
iconUrl: new URL('../../Images/accessibility-icon.svg', import.meta.url).toString(),
|
|
153
|
+
title,
|
|
154
|
+
};
|
|
155
|
+
button.tabIndex = 0;
|
|
156
|
+
button.classList.add('axtree-button');
|
|
147
157
|
if (isActive) {
|
|
148
|
-
button.classList.add('
|
|
149
|
-
} else {
|
|
150
|
-
button.classList.add('axtree-button');
|
|
158
|
+
button.classList.add('active');
|
|
151
159
|
}
|
|
152
|
-
button.tabIndex = 0;
|
|
153
|
-
button.title =
|
|
154
|
-
isActive ? i18nString(UIStrings.switchToDomTreeView) : i18nString(UIStrings.switchToAccessibilityTreeView);
|
|
155
|
-
const icon = new IconButton.Icon.Icon();
|
|
156
|
-
const bgColor = isActive ? 'var(--color-primary)' : 'var(--color-text-secondary)';
|
|
157
|
-
icon.data = {iconName: 'accessibility-icon', color: bgColor, width: '16px', height: '16px'};
|
|
158
|
-
button.appendChild(icon);
|
|
159
160
|
return button;
|
|
160
161
|
};
|
|
161
162
|
|
|
@@ -185,8 +186,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
185
186
|
private readonly adornerManager: ElementsComponents.AdornerManager.AdornerManager;
|
|
186
187
|
private adornerSettingsPane: ElementsComponents.AdornerSettingsPane.AdornerSettingsPane|null;
|
|
187
188
|
private readonly adornersByName: Map<string, Set<Adorners.Adorner.Adorner>>;
|
|
188
|
-
accessibilityTreeButton?:
|
|
189
|
-
domTreeButton?:
|
|
189
|
+
accessibilityTreeButton?: HTMLElement;
|
|
190
|
+
domTreeButton?: HTMLElement;
|
|
190
191
|
private selectedNodeOnReset?: SDK.DOMModel.DOMNode;
|
|
191
192
|
private hasNonDefaultSelectedNode?: boolean;
|
|
192
193
|
private searchConfig?: UI.SearchableView.SearchConfig;
|
|
@@ -82,11 +82,13 @@ devtools-tree-outline {
|
|
|
82
82
|
|
|
83
83
|
.axtree-button {
|
|
84
84
|
position: absolute;
|
|
85
|
-
padding: 4px;
|
|
86
85
|
top: 16px;
|
|
87
|
-
right:
|
|
86
|
+
right: 20px;
|
|
87
|
+
background-color: var(--color-background-elevation-1);
|
|
88
88
|
display: flex;
|
|
89
89
|
justify-content: center;
|
|
90
90
|
align-items: center;
|
|
91
91
|
z-index: 1;
|
|
92
|
+
border: 1px solid var(--color-details-hairline);
|
|
93
|
+
border-radius: 3px;
|
|
92
94
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
|
+
import * as Host from '../../core/host/host.js';
|
|
6
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
8
|
import * as Root from '../../core/root/root.js';
|
|
8
9
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
@@ -1097,17 +1098,19 @@ UI.ActionRegistration.registerActionExtension({
|
|
|
1097
1098
|
title: i18nLazyString(UIStrings.createNewSnippet),
|
|
1098
1099
|
});
|
|
1099
1100
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1101
|
+
if (!Host.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()) {
|
|
1102
|
+
UI.ActionRegistration.registerActionExtension({
|
|
1103
|
+
category: UI.ActionRegistration.ActionCategory.SOURCES,
|
|
1104
|
+
actionId: 'sources.add-folder-to-workspace',
|
|
1105
|
+
async loadActionDelegate() {
|
|
1106
|
+
const Sources = await loadSourcesModule();
|
|
1107
|
+
return Sources.SourcesNavigator.ActionDelegate.instance();
|
|
1108
|
+
},
|
|
1109
|
+
iconClass: UI.ActionRegistration.IconClass.LARGE_ICON_ADD,
|
|
1110
|
+
title: i18nLazyString(UIStrings.addFolderToWorkspace),
|
|
1111
|
+
condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER,
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1111
1114
|
|
|
1112
1115
|
UI.ActionRegistration.registerActionExtension({
|
|
1113
1116
|
category: UI.ActionRegistration.ActionCategory.DEBUGGER,
|
|
@@ -36,6 +36,7 @@ interface ButtonState {
|
|
|
36
36
|
spinner?: boolean;
|
|
37
37
|
type: ButtonType;
|
|
38
38
|
value?: string;
|
|
39
|
+
title?: string;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export type ButtonData = {
|
|
@@ -47,6 +48,7 @@ export type ButtonData = {
|
|
|
47
48
|
spinner?: boolean,
|
|
48
49
|
type?: ButtonType,
|
|
49
50
|
value?: string,
|
|
51
|
+
title?: string,
|
|
50
52
|
}|{
|
|
51
53
|
variant: Variant.PRIMARY | Variant.SECONDARY,
|
|
52
54
|
iconUrl?: string,
|
|
@@ -56,6 +58,7 @@ export type ButtonData = {
|
|
|
56
58
|
spinner?: boolean,
|
|
57
59
|
type?: ButtonType,
|
|
58
60
|
value?: string,
|
|
61
|
+
title?: string,
|
|
59
62
|
};
|
|
60
63
|
|
|
61
64
|
interface ButtonElementInternals extends ElementInternals {
|
|
@@ -101,6 +104,7 @@ export class Button extends HTMLElement {
|
|
|
101
104
|
this.#props.spinner = Boolean(data.spinner);
|
|
102
105
|
this.#props.type = data.type || 'button';
|
|
103
106
|
this.#setDisabledProperty(data.disabled || false);
|
|
107
|
+
this.#props.title = data.title;
|
|
104
108
|
void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
|
|
105
109
|
}
|
|
106
110
|
|
|
@@ -208,7 +212,7 @@ export class Button extends HTMLElement {
|
|
|
208
212
|
// clang-format off
|
|
209
213
|
LitHtml.render(
|
|
210
214
|
LitHtml.html`
|
|
211
|
-
<button .disabled=${this.#props.disabled} class=${LitHtml.Directives.classMap(classes)}>
|
|
215
|
+
<button .title=${this.#props.title} .disabled=${this.#props.disabled} class=${LitHtml.Directives.classMap(classes)}>
|
|
212
216
|
${this.#props.iconUrl ? LitHtml.html`<${IconButton.Icon.Icon.litTagName}
|
|
213
217
|
.data=${{
|
|
214
218
|
iconPath: this.#props.iconUrl,
|
|
@@ -169,7 +169,7 @@ button.toolbar devtools-icon {
|
|
|
169
169
|
width: 24px;
|
|
170
170
|
height: 24px;
|
|
171
171
|
|
|
172
|
-
--icon-color: var(--color-text-
|
|
172
|
+
--icon-color: var(--color-text-secondary);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
button.primary devtools-icon {
|
|
@@ -190,6 +190,15 @@ button.toolbar.small devtools-icon {
|
|
|
190
190
|
height: 18px;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
button.toolbar.active devtools-icon,
|
|
194
|
+
button.toolbar:active devtools-icon {
|
|
195
|
+
--icon-color: var(--color-primary);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
button.toolbar:hover devtools-icon {
|
|
199
|
+
--icon-color: var(--color-text-primary);
|
|
200
|
+
}
|
|
201
|
+
|
|
193
202
|
button.toolbar:disabled devtools-icon {
|
|
194
203
|
--icon-color: var(--color-text-disabled);
|
|
195
204
|
}
|
|
@@ -354,6 +354,7 @@ select.toolbar-item:focus-visible > * {
|
|
|
354
354
|
overflow: hidden;
|
|
355
355
|
white-space: nowrap;
|
|
356
356
|
cursor: auto;
|
|
357
|
+
color: var(--color-text-primary);
|
|
357
358
|
}
|
|
358
359
|
/* Separator */
|
|
359
360
|
|
|
@@ -394,6 +395,7 @@ input[is="history-input"] {
|
|
|
394
395
|
border: 1px solid transparent;
|
|
395
396
|
line-height: 16px;
|
|
396
397
|
padding: 1px;
|
|
398
|
+
color: var(--color-text-primary);
|
|
397
399
|
}
|
|
398
400
|
|
|
399
401
|
input[is="history-input"]:hover {
|
package/package.json
CHANGED