chrome-devtools-frontend 1.0.1514545 → 1.0.1515446

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.
Files changed (77) hide show
  1. package/AUTHORS +1 -0
  2. package/docs/committers_policy.md +1 -1
  3. package/docs/contributing/infrastructure.md +101 -5
  4. package/front_end/Images/gdp-logo-dark.png +0 -0
  5. package/front_end/Images/gdp-logo-light.png +0 -0
  6. package/front_end/core/common/Settings.ts +11 -32
  7. package/front_end/global_typings/global_defs.d.ts +15 -1
  8. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +22 -23
  9. package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +6 -7
  10. package/front_end/models/ai_assistance/ai_assistance.ts +3 -0
  11. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +77 -2
  12. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +76 -10
  13. package/front_end/models/cpu_profile/ProfileTreeModel.ts +1 -1
  14. package/front_end/models/extensions/ExtensionPanel.ts +4 -0
  15. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +5 -1
  16. package/front_end/models/trace/helpers/Trace.ts +1 -1
  17. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +6 -7
  18. package/front_end/panels/ai_assistance/components/ChatView.ts +1 -2
  19. package/front_end/panels/common/GdpSignUpDialog.ts +2 -6
  20. package/front_end/panels/common/gdpSignUpDialog.css +6 -14
  21. package/front_end/panels/console/ConsoleView.ts +4 -0
  22. package/front_end/panels/elements/ElementsPanel.ts +4 -0
  23. package/front_end/panels/elements/StylePropertiesSection.ts +4 -4
  24. package/front_end/panels/network/NetworkConfigView.ts +1 -1
  25. package/front_end/panels/network/NetworkLogView.ts +2 -2
  26. package/front_end/panels/network/components/HeaderSectionRow.ts +2 -3
  27. package/front_end/panels/profiler/HeapProfileView.ts +1 -3
  28. package/front_end/panels/profiler/HeapSnapshotView.ts +5 -1
  29. package/front_end/panels/profiler/ProfileDataGrid.ts +4 -0
  30. package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +7 -29
  31. package/front_end/panels/profiler/ProfileView.ts +4 -0
  32. package/front_end/panels/recorder/components/CreateRecordingView.ts +2 -2
  33. package/front_end/panels/search/SearchView.ts +219 -205
  34. package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
  35. package/front_end/panels/settings/SettingsScreen.ts +1 -1
  36. package/front_end/panels/settings/components/SyncSection.ts +2 -6
  37. package/front_end/panels/settings/components/syncSection.css +11 -4
  38. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +3 -3
  39. package/front_end/panels/sources/SourcesView.ts +4 -0
  40. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -2
  41. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +6 -3
  42. package/front_end/panels/timeline/CountersGraph.ts +5 -5
  43. package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
  44. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +4 -3
  45. package/front_end/panels/timeline/TimelineFlameChartView.ts +9 -4
  46. package/front_end/panels/timeline/TimelineHistoryManager.ts +2 -2
  47. package/front_end/panels/timeline/TimelinePanel.ts +4 -3
  48. package/front_end/panels/timeline/TimelineTreeView.ts +6 -2
  49. package/front_end/panels/timeline/TimelineUIUtils.ts +2 -1
  50. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +2 -2
  51. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +6 -6
  52. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +2 -2
  53. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -3
  54. package/front_end/panels/timeline/utils/utils.ts +0 -8
  55. package/front_end/{panels/timeline/utils → services/tracing}/FreshRecording.ts +1 -1
  56. package/front_end/services/tracing/tracing.ts +2 -0
  57. package/front_end/ui/legacy/Dialog.ts +38 -13
  58. package/front_end/ui/legacy/InspectorView.ts +7 -9
  59. package/front_end/ui/legacy/SearchableView.ts +73 -55
  60. package/front_end/ui/legacy/SettingsUI.ts +5 -5
  61. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +1 -4
  62. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +5 -5
  63. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +2 -2
  64. package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +2 -2
  65. package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +1 -4
  66. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +3 -3
  67. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -2
  68. package/front_end/ui/legacy/components/source_frame/JSONView.ts +10 -10
  69. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +4 -0
  70. package/front_end/ui/legacy/components/source_frame/XMLView.ts +4 -0
  71. package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -4
  72. package/front_end/ui/legacy/searchableView.css +0 -4
  73. package/package.json +1 -1
  74. package/front_end/Images/src/gdp-logo-standalone.svg +0 -9
  75. /package/front_end/{panels/timeline/utils → models/ai_assistance/performance}/AICallTree.ts +0 -0
  76. /package/front_end/{panels/timeline/utils → models/ai_assistance/performance}/AIContext.ts +0 -0
  77. /package/front_end/{panels/timeline/utils/InsightAIContext.ts → models/ai_assistance/performance/AIQueries.ts} +0 -0
@@ -109,33 +109,32 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
109
109
  const {ref} = Directives;
110
110
 
111
111
  export class SearchView extends UI.Widget.VBox {
112
- private focusOnShow: boolean;
113
- private isIndexing: boolean;
114
- private searchId: number;
115
- private searchMatchesCount: number;
116
- private searchResultsCount: number;
117
- private nonEmptySearchResultsCount: number;
118
- private searchingView: UI.Widget.Widget|null;
119
- private notFoundView: UI.Widget.Widget|null;
120
- private searchConfig: Workspace.SearchConfig.SearchConfig|null;
121
- private pendingSearchConfig: Workspace.SearchConfig.SearchConfig|null;
122
- private searchResultsPane: SearchResultsPane|null;
123
- private progressIndicator: UI.ProgressIndicator.ProgressIndicator|null;
124
- private visiblePane: UI.Widget.Widget|null;
125
- private searchPanelElement!: HTMLElement;
126
- private searchResultsElement!: HTMLElement;
127
- protected search!: HTMLInputElement;
128
- protected matchCaseButton!: Buttons.Button.Button;
129
- protected regexButton!: Buttons.Button.Button;
130
- private searchMessageElement!: HTMLElement;
131
- private searchProgressPlaceholderElement!: HTMLElement;
132
- private searchResultsMessageElement!: HTMLElement;
133
- private readonly advancedSearchConfig: Common.Settings.Setting<{
112
+ #focusOnShow: boolean;
113
+ #isIndexing: boolean;
114
+ #searchId: number;
115
+ #searchMatchesCount: number;
116
+ #searchResultsCount: number;
117
+ #nonEmptySearchResultsCount: number;
118
+ #searchingView: UI.Widget.Widget|null;
119
+ #notFoundView: UI.Widget.Widget|null;
120
+ #searchConfig: Workspace.SearchConfig.SearchConfig|null;
121
+ #pendingSearchConfig: Workspace.SearchConfig.SearchConfig|null;
122
+ #searchResultsPane: SearchResultsPane|null;
123
+ #progressIndicator: UI.ProgressIndicator.ProgressIndicator|null;
124
+ #visiblePane: UI.Widget.Widget|null;
125
+ #searchResultsElement!: HTMLElement;
126
+ #searchInputElement!: HTMLInputElement;
127
+ #matchCaseButton!: Buttons.Button.Button;
128
+ #regexButton!: Buttons.Button.Button;
129
+ #searchMessageElement!: HTMLElement;
130
+ #searchProgressPlaceholderElement!: HTMLElement;
131
+ #searchResultsMessageElement!: HTMLElement;
132
+ readonly #advancedSearchConfig: Common.Settings.Setting<{
134
133
  query: string,
135
134
  ignoreCase: boolean,
136
135
  isRegex: boolean,
137
136
  }>;
138
- private searchScope: SearchScope|null;
137
+ #searchScope: SearchScope|null;
139
138
 
140
139
  // We throttle adding search results, otherwise we trigger DOM layout for each
141
140
  // result added.
@@ -150,27 +149,26 @@ export class SearchView extends UI.Widget.VBox {
150
149
  });
151
150
  this.setMinimumSize(0, 40);
152
151
 
153
- this.focusOnShow = false;
154
- this.isIndexing = false;
155
- this.searchId = 1;
156
- this.searchMatchesCount = 0;
157
- this.searchResultsCount = 0;
158
- this.nonEmptySearchResultsCount = 0;
159
- this.searchingView = null;
160
- this.notFoundView = null;
161
- this.searchConfig = null;
162
- this.pendingSearchConfig = null;
163
- this.searchResultsPane = null;
164
- this.progressIndicator = null;
165
- this.visiblePane = null;
152
+ this.#focusOnShow = false;
153
+ this.#isIndexing = false;
154
+ this.#searchId = 1;
155
+ this.#searchMatchesCount = 0;
156
+ this.#searchResultsCount = 0;
157
+ this.#nonEmptySearchResultsCount = 0;
158
+ this.#searchingView = null;
159
+ this.#notFoundView = null;
160
+ this.#searchConfig = null;
161
+ this.#pendingSearchConfig = null;
162
+ this.#searchResultsPane = null;
163
+ this.#progressIndicator = null;
164
+ this.#visiblePane = null;
166
165
  this.#throttler = throttler;
167
166
 
168
167
  // clang-format off
169
168
  /* eslint-disable-next-line rulesdir/no-lit-render-outside-of-view */
170
169
  render(html`
171
170
  <style>${searchViewStyles}</style>
172
- <div class="search-drawer-header" @keydown=${this.onKeyDownOnPanel}
173
- ${ref(e => {this.searchPanelElement = e as HTMLElement;})}>
171
+ <div class="search-drawer-header" @keydown=${this.#onPanelKeyDown}>
174
172
  <div class="search-container">
175
173
  <div class="toolbar-item-search">
176
174
  <devtools-icon name="search"></devtools-icon>
@@ -181,10 +179,10 @@ export class SearchView extends UI.Widget.VBox {
181
179
  change: true, keydown: 'ArrowUp|ArrowDown|Enter'})}
182
180
  aria-label=${i18nString(UIStrings.find)}
183
181
  size="100" results="0"
184
- @keydown=${this.onKeyDown}
185
- ${ref(e => {this.search = e as HTMLInputElement;})}>
182
+ @keydown=${this.#onQueryKeyDown}
183
+ ${ref(e => {this.#searchInputElement = e as HTMLInputElement;})}>
186
184
  <devtools-button class="clear-button" tabindex="-1"
187
- @click=${this.onSearchInputClear}
185
+ @click=${this.#onClearSearchInput}
188
186
  .data=${{
189
187
  variant: Buttons.Button.Variant.ICON,
190
188
  iconName: 'cross-circle-filled',
@@ -193,7 +191,7 @@ export class SearchView extends UI.Widget.VBox {
193
191
  title: i18nString(UIStrings.clearInput),
194
192
  } as Buttons.Button.ButtonData}
195
193
  ></devtools-button>
196
- <devtools-button @click=${this.regexButtonToggled} .data=${{
194
+ <devtools-button @click=${this.#onToggleRegex} .data=${{
197
195
  variant: Buttons.Button.Variant.ICON_TOGGLE,
198
196
  iconName: 'regular-expression',
199
197
  toggledIconName: 'regular-expression',
@@ -203,9 +201,9 @@ export class SearchView extends UI.Widget.VBox {
203
201
  title: i18nString(UIStrings.enableRegularExpression),
204
202
  jslogContext: 'regular-expression',
205
203
  } as Buttons.Button.ButtonData}
206
- ${ref(e => {this.regexButton = e as Buttons.Button.Button;})}
204
+ ${ref(e => {this.#regexButton = e as Buttons.Button.Button;})}
207
205
  ></devtools-button>
208
- <devtools-button @click=${this.matchCaseButtonToggled} .data=${{
206
+ <devtools-button @click=${this.#onToggleMatchCase} .data=${{
209
207
  variant: Buttons.Button.Variant.ICON_TOGGLE,
210
208
  iconName: 'match-case',
211
209
  toggledIconName: 'match-case',
@@ -215,18 +213,18 @@ export class SearchView extends UI.Widget.VBox {
215
213
  title: i18nString(UIStrings.enableCaseSensitive),
216
214
  jslogContext: 'match-case',
217
215
  } as Buttons.Button.ButtonData}
218
- ${ref(e => {this.matchCaseButton = e as Buttons.Button.Button;})}
216
+ ${ref(e => {this.#matchCaseButton = e as Buttons.Button.Button;})}
219
217
  ></devtools-button>
220
218
  </div>
221
219
  </div>
222
220
  <devtools-toolbar class="search-toolbar" jslog=${VisualLogging.toolbar()}>
223
- <devtools-button title=${i18nString(UIStrings.refresh)} @click=${this.onAction}
221
+ <devtools-button title=${i18nString(UIStrings.refresh)} @click=${this.#onRefresh}
224
222
  .data=${{
225
223
  variant: Buttons.Button.Variant.TOOLBAR,
226
224
  iconName: 'refresh',
227
225
  jslogContext: 'search.refresh',
228
226
  } as Buttons.Button.ButtonData}></devtools-button>
229
- <devtools-button title=${i18nString(UIStrings.clear)} @click=${this.onClearSearch}
227
+ <devtools-button title=${i18nString(UIStrings.clear)} @click=${this.#onClearSearch}
230
228
  .data=${{
231
229
  variant: Buttons.Button.Variant.TOOLBAR,
232
230
  iconName: 'clear',
@@ -234,59 +232,59 @@ export class SearchView extends UI.Widget.VBox {
234
232
  } as Buttons.Button.ButtonData}></devtools-button>
235
233
  </devtools-toolbar>
236
234
  </div>
237
- <div class="search-results" @keydown=${this.onKeyDownOnPanel}
238
- ${ref(e => {this.searchResultsElement = e as HTMLElement;})}>
235
+ <div class="search-results" @keydown=${this.#onPanelKeyDown}
236
+ ${ref(e => {this.#searchResultsElement = e as HTMLElement;})}>
239
237
  </div>
240
- <div class="search-toolbar-summary" @keydown=${this.onKeyDownOnPanel}>
241
- <div class="search-message" ${ref(e => {this.searchMessageElement = e as HTMLElement;})}></div>
242
- <div class="flex-centered" ${ref(e => {this.searchProgressPlaceholderElement = e as HTMLElement;})}>
238
+ <div class="search-toolbar-summary" @keydown=${this.#onPanelKeyDown}>
239
+ <div class="search-message" ${ref(e => {this.#searchMessageElement = e as HTMLElement;})}></div>
240
+ <div class="flex-centered" ${ref(e => {this.#searchProgressPlaceholderElement = e as HTMLElement;})}>
243
241
  </div>
244
- <div class="search-message" ${ref(e => {this.searchResultsMessageElement = e as HTMLElement;})}>
242
+ <div class="search-message" ${ref(e => {this.#searchResultsMessageElement = e as HTMLElement;})}>
245
243
  </div>
246
244
  </div>`, this.contentElement, {host: this});
247
245
  // clang-format on
248
246
 
249
- this.advancedSearchConfig = Common.Settings.Settings.instance().createLocalSetting(
247
+ this.#advancedSearchConfig = Common.Settings.Settings.instance().createLocalSetting(
250
248
  settingKey + '-search-config', new Workspace.SearchConfig.SearchConfig('', true, false).toPlainObject());
251
249
 
252
- this.load();
253
- this.searchScope = null;
250
+ this.#load();
251
+ this.#searchScope = null;
254
252
 
255
253
  this.#emptyStartView = new UI.EmptyWidget.EmptyWidget(
256
254
  i18nString(UIStrings.noSearchResult), i18nString(UIStrings.typeAndPressSToSearch, {
257
255
  PH1: UI.KeyboardShortcut.KeyboardShortcut.shortcutToString(UI.KeyboardShortcut.Keys.Enter)
258
256
  }));
259
- this.showPane(this.#emptyStartView);
257
+ this.#showPane(this.#emptyStartView);
260
258
  }
261
259
 
262
- regexButtonToggled(): void {
263
- this.regexButton.title = this.regexButton.toggled ? i18nString(UIStrings.disableRegularExpression) :
264
- i18nString(UIStrings.enableRegularExpression);
260
+ #onToggleRegex(): void {
261
+ this.#regexButton.title = this.#regexButton.toggled ? i18nString(UIStrings.disableRegularExpression) :
262
+ i18nString(UIStrings.enableRegularExpression);
265
263
  }
266
264
 
267
- matchCaseButtonToggled(): void {
268
- this.matchCaseButton.title = this.matchCaseButton.toggled ? i18nString(UIStrings.disableCaseSensitive) :
269
- i18nString(UIStrings.enableCaseSensitive);
265
+ #onToggleMatchCase(): void {
266
+ this.#matchCaseButton.title = this.#matchCaseButton.toggled ? i18nString(UIStrings.disableCaseSensitive) :
267
+ i18nString(UIStrings.enableCaseSensitive);
270
268
  }
271
269
 
272
- private buildSearchConfig(): Workspace.SearchConfig.SearchConfig {
270
+ #buildSearchConfig(): Workspace.SearchConfig.SearchConfig {
273
271
  return new Workspace.SearchConfig.SearchConfig(
274
- this.search.value, !this.matchCaseButton.toggled, this.regexButton.toggled);
272
+ this.#searchInputElement.value, !this.#matchCaseButton.toggled, this.#regexButton.toggled);
275
273
  }
276
274
 
277
275
  toggle(queryCandidate: string, searchImmediately?: boolean): void {
278
- this.search.value = queryCandidate;
276
+ this.#searchInputElement.value = queryCandidate;
279
277
  if (this.isShowing()) {
280
278
  this.focus();
281
279
  } else {
282
- this.focusOnShow = true;
280
+ this.#focusOnShow = true;
283
281
  }
284
282
 
285
- this.initScope();
283
+ this.#initScope();
286
284
  if (searchImmediately) {
287
- this.onAction();
285
+ this.#onRefresh();
288
286
  } else {
289
- this.startIndexing();
287
+ this.#startIndexing();
290
288
  }
291
289
  }
292
290
 
@@ -294,208 +292,212 @@ export class SearchView extends UI.Widget.VBox {
294
292
  throw new Error('Not implemented');
295
293
  }
296
294
 
297
- private initScope(): void {
298
- this.searchScope = this.createScope();
295
+ #initScope(): void {
296
+ this.#searchScope = this.createScope();
299
297
  }
300
298
 
301
299
  override wasShown(): void {
302
300
  super.wasShown();
303
- if (this.focusOnShow) {
301
+ if (this.#focusOnShow) {
304
302
  this.focus();
305
- this.focusOnShow = false;
303
+ this.#focusOnShow = false;
306
304
  }
307
305
  }
308
306
 
309
- private onIndexingFinished(): void {
310
- if (!this.progressIndicator) {
307
+ #onIndexingFinished(): void {
308
+ if (!this.#progressIndicator) {
311
309
  return;
312
310
  }
313
311
 
314
- const finished = !this.progressIndicator.isCanceled();
315
- this.progressIndicator.done();
316
- this.progressIndicator = null;
317
- this.isIndexing = false;
318
- this.searchMessageElement.textContent = finished ? '' : i18nString(UIStrings.indexingInterrupted);
312
+ const finished = !this.#progressIndicator.isCanceled();
313
+ this.#progressIndicator.done();
314
+ this.#progressIndicator = null;
315
+ this.#isIndexing = false;
316
+ this.#searchMessageElement.textContent = finished ? '' : i18nString(UIStrings.indexingInterrupted);
319
317
  if (!finished) {
320
- this.pendingSearchConfig = null;
318
+ this.#pendingSearchConfig = null;
321
319
  }
322
- if (!this.pendingSearchConfig) {
320
+ if (!this.#pendingSearchConfig) {
323
321
  return;
324
322
  }
325
- const searchConfig = this.pendingSearchConfig;
326
- this.pendingSearchConfig = null;
327
- this.innerStartSearch(searchConfig);
323
+ const searchConfig = this.#pendingSearchConfig;
324
+ this.#pendingSearchConfig = null;
325
+ this.#innerStartSearch(searchConfig);
328
326
  }
329
327
 
330
- private startIndexing(): void {
331
- this.isIndexing = true;
332
- if (this.progressIndicator) {
333
- this.progressIndicator.done();
328
+ #startIndexing(): void {
329
+ this.#isIndexing = true;
330
+ if (this.#progressIndicator) {
331
+ this.#progressIndicator.done();
334
332
  }
335
- this.progressIndicator = document.createElement('devtools-progress');
336
- this.searchMessageElement.textContent = i18nString(UIStrings.indexing);
337
- this.searchProgressPlaceholderElement.appendChild(this.progressIndicator);
338
- if (this.searchScope) {
339
- this.searchScope.performIndexing(
340
- new Common.Progress.ProgressProxy(this.progressIndicator, this.onIndexingFinished.bind(this)));
333
+ this.#progressIndicator = document.createElement('devtools-progress');
334
+ this.#searchMessageElement.textContent = i18nString(UIStrings.indexing);
335
+ this.#searchProgressPlaceholderElement.appendChild(this.#progressIndicator);
336
+ if (this.#searchScope) {
337
+ this.#searchScope.performIndexing(
338
+ new Common.Progress.ProgressProxy(this.#progressIndicator, this.#onIndexingFinished.bind(this)));
341
339
  }
342
340
  }
343
341
 
344
- private onSearchInputClear(): void {
345
- this.search.value = '';
346
- this.save();
342
+ #onClearSearchInput(): void {
343
+ this.#searchInputElement.value = '';
344
+ this.#save();
347
345
  this.focus();
348
- this.showPane(this.#emptyStartView);
346
+ this.#showPane(this.#emptyStartView);
349
347
  }
350
348
 
351
- private onSearchResult(searchId: number, searchResult: SearchResult): void {
352
- if (searchId !== this.searchId || !this.progressIndicator) {
349
+ #onSearchResult(searchId: number, searchResult: SearchResult): void {
350
+ if (searchId !== this.#searchId || !this.#progressIndicator) {
353
351
  return;
354
352
  }
355
- if (this.progressIndicator?.isCanceled()) {
356
- this.onIndexingFinished();
353
+ if (this.#progressIndicator?.isCanceled()) {
354
+ this.#onIndexingFinished();
357
355
  return;
358
356
  }
359
- if (!this.searchResultsPane) {
360
- this.searchResultsPane = new SearchResultsPane((this.searchConfig as Workspace.SearchConfig.SearchConfig));
361
- this.showPane(this.searchResultsPane);
357
+ if (!this.#searchResultsPane) {
358
+ this.#searchResultsPane = this.createSearchResultsPane();
359
+ this.#showPane(this.#searchResultsPane);
362
360
  }
363
361
  this.#pendingSearchResults.push(searchResult);
364
362
  void this.#throttler.schedule(async () => this.#addPendingSearchResults());
365
363
  }
366
364
 
365
+ protected createSearchResultsPane(): SearchResultsPane {
366
+ return new SearchResultsPane((this.#searchConfig as Workspace.SearchConfig.SearchConfig));
367
+ }
368
+
367
369
  #addPendingSearchResults(): void {
368
370
  for (const searchResult of this.#pendingSearchResults) {
369
- this.addSearchResult(searchResult);
371
+ this.#addSearchResult(searchResult);
370
372
  if (searchResult.matchesCount()) {
371
- this.searchResultsPane?.addSearchResult(searchResult);
373
+ this.#searchResultsPane?.addSearchResult(searchResult);
372
374
  }
373
375
  }
374
376
  this.#pendingSearchResults = [];
375
377
  }
376
378
 
377
- private onSearchFinished(searchId: number, finished: boolean): void {
378
- if (searchId !== this.searchId || !this.progressIndicator) {
379
+ #onSearchFinished(searchId: number, finished: boolean): void {
380
+ if (searchId !== this.#searchId || !this.#progressIndicator) {
379
381
  return;
380
382
  }
381
- if (!this.searchResultsPane) {
382
- this.nothingFound();
383
+ if (!this.#searchResultsPane) {
384
+ this.#nothingFound();
383
385
  }
384
- this.searchFinished(finished);
385
- this.searchConfig = null;
386
+ this.#searchFinished(finished);
387
+ this.#searchConfig = null;
386
388
  UI.ARIAUtils.LiveAnnouncer.alert(
387
- this.searchMessageElement.textContent + ' ' + this.searchResultsMessageElement.textContent);
389
+ this.#searchMessageElement.textContent + ' ' + this.#searchResultsMessageElement.textContent);
388
390
  }
389
391
 
390
- private innerStartSearch(searchConfig: Workspace.SearchConfig.SearchConfig): void {
391
- this.searchConfig = searchConfig;
392
- if (this.progressIndicator) {
393
- this.progressIndicator.done();
392
+ #innerStartSearch(searchConfig: Workspace.SearchConfig.SearchConfig): void {
393
+ this.#searchConfig = searchConfig;
394
+ if (this.#progressIndicator) {
395
+ this.#progressIndicator.done();
394
396
  }
395
- this.progressIndicator = document.createElement('devtools-progress');
396
- this.searchStarted(this.progressIndicator);
397
- if (this.searchScope) {
398
- void this.searchScope.performSearch(
399
- searchConfig, this.progressIndicator, this.onSearchResult.bind(this, this.searchId),
400
- this.onSearchFinished.bind(this, this.searchId));
397
+ this.#progressIndicator = document.createElement('devtools-progress');
398
+ this.#searchStarted(this.#progressIndicator);
399
+ if (this.#searchScope) {
400
+ void this.#searchScope.performSearch(
401
+ searchConfig, this.#progressIndicator, this.#onSearchResult.bind(this, this.#searchId),
402
+ this.#onSearchFinished.bind(this, this.#searchId));
401
403
  }
402
404
  }
403
405
 
404
- private resetSearch(): void {
405
- this.stopSearch();
406
- this.showPane(null);
407
- this.searchResultsPane = null;
408
- this.searchMessageElement.textContent = '';
409
- this.searchResultsMessageElement.textContent = '';
406
+ #resetSearch(): void {
407
+ this.#stopSearch();
408
+ this.#showPane(null);
409
+ this.#searchResultsPane = null;
410
+ this.#searchMessageElement.textContent = '';
411
+ this.#searchResultsMessageElement.textContent = '';
410
412
  }
411
413
 
412
- private stopSearch(): void {
413
- if (this.progressIndicator && !this.isIndexing) {
414
- this.progressIndicator.cancel();
414
+ #stopSearch(): void {
415
+ if (this.#progressIndicator && !this.#isIndexing) {
416
+ this.#progressIndicator.cancel();
415
417
  }
416
- if (this.searchScope) {
417
- this.searchScope.stopSearch();
418
+ if (this.#searchScope) {
419
+ this.#searchScope.stopSearch();
418
420
  }
419
- this.searchConfig = null;
421
+ this.#searchConfig = null;
420
422
  }
421
423
 
422
- private searchStarted(progressIndicator: UI.ProgressIndicator.ProgressIndicator): void {
423
- this.searchMatchesCount = 0;
424
- this.searchResultsCount = 0;
425
- this.nonEmptySearchResultsCount = 0;
426
- if (!this.searchingView) {
427
- this.searchingView = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.searching), '');
424
+ #searchStarted(progressIndicator: UI.ProgressIndicator.ProgressIndicator): void {
425
+ this.#searchMatchesCount = 0;
426
+ this.#searchResultsCount = 0;
427
+ this.#nonEmptySearchResultsCount = 0;
428
+ if (!this.#searchingView) {
429
+ this.#searchingView = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.searching), '');
428
430
  }
429
- this.showPane(this.searchingView);
430
- this.searchMessageElement.textContent = i18nString(UIStrings.searching);
431
- this.searchProgressPlaceholderElement.appendChild(progressIndicator);
432
- this.updateSearchResultsMessage();
433
- }
434
-
435
- private updateSearchResultsMessage(): void {
436
- if (this.searchMatchesCount && this.searchResultsCount) {
437
- if (this.searchMatchesCount === 1 && this.nonEmptySearchResultsCount === 1) {
438
- this.searchResultsMessageElement.textContent = i18nString(UIStrings.foundMatchingLineInFile);
439
- } else if (this.searchMatchesCount > 1 && this.nonEmptySearchResultsCount === 1) {
440
- this.searchResultsMessageElement.textContent =
441
- i18nString(UIStrings.foundDMatchingLinesInFile, {PH1: this.searchMatchesCount});
431
+ this.#showPane(this.#searchingView);
432
+ this.#searchMessageElement.textContent = i18nString(UIStrings.searching);
433
+ this.#searchProgressPlaceholderElement.appendChild(progressIndicator);
434
+ this.#updateSearchResultsMessage();
435
+ }
436
+
437
+ #updateSearchResultsMessage(): void {
438
+ if (this.#searchMatchesCount && this.#searchResultsCount) {
439
+ if (this.#searchMatchesCount === 1 && this.#nonEmptySearchResultsCount === 1) {
440
+ this.#searchResultsMessageElement.textContent = i18nString(UIStrings.foundMatchingLineInFile);
441
+ } else if (this.#searchMatchesCount > 1 && this.#nonEmptySearchResultsCount === 1) {
442
+ this.#searchResultsMessageElement.textContent =
443
+ i18nString(UIStrings.foundDMatchingLinesInFile, {PH1: this.#searchMatchesCount});
442
444
  } else {
443
- this.searchResultsMessageElement.textContent = i18nString(
445
+ this.#searchResultsMessageElement.textContent = i18nString(
444
446
  UIStrings.foundDMatchingLinesInDFiles,
445
- {PH1: this.searchMatchesCount, PH2: this.nonEmptySearchResultsCount});
447
+ {PH1: this.#searchMatchesCount, PH2: this.#nonEmptySearchResultsCount});
446
448
  }
447
449
  } else {
448
- this.searchResultsMessageElement.textContent = '';
450
+ this.#searchResultsMessageElement.textContent = '';
449
451
  }
450
452
  }
451
453
 
452
- private showPane(panel: UI.Widget.Widget|null): void {
453
- if (this.visiblePane) {
454
- this.visiblePane.detach();
454
+ #showPane(panel: UI.Widget.Widget|null): void {
455
+ if (this.#visiblePane) {
456
+ this.#visiblePane.detach();
455
457
  }
456
458
  if (panel) {
457
- panel.show(this.searchResultsElement);
459
+ panel.show(this.#searchResultsElement);
458
460
  }
459
- this.visiblePane = panel;
461
+ this.#visiblePane = panel;
460
462
  }
461
463
 
462
- private nothingFound(): void {
463
- if (!this.notFoundView) {
464
- this.notFoundView = new UI.EmptyWidget.EmptyWidget(
464
+ #nothingFound(): void {
465
+ if (!this.#notFoundView) {
466
+ this.#notFoundView = new UI.EmptyWidget.EmptyWidget(
465
467
  i18nString(UIStrings.noMatchesFound), i18nString(UIStrings.nothingMatchedTheQuery));
466
468
  }
467
- this.showPane(this.notFoundView);
469
+ this.#showPane(this.#notFoundView);
468
470
  }
469
471
 
470
- private addSearchResult(searchResult: SearchResult): void {
472
+ #addSearchResult(searchResult: SearchResult): void {
471
473
  const matchesCount = searchResult.matchesCount();
472
- this.searchMatchesCount += matchesCount;
473
- this.searchResultsCount++;
474
+ this.#searchMatchesCount += matchesCount;
475
+ this.#searchResultsCount++;
474
476
  if (matchesCount) {
475
- this.nonEmptySearchResultsCount++;
477
+ this.#nonEmptySearchResultsCount++;
476
478
  }
477
- this.updateSearchResultsMessage();
479
+ this.#updateSearchResultsMessage();
478
480
  }
479
481
 
480
- private searchFinished(finished: boolean): void {
481
- this.searchMessageElement.textContent =
482
+ #searchFinished(finished: boolean): void {
483
+ this.#searchMessageElement.textContent =
482
484
  finished ? i18nString(UIStrings.searchFinished) : i18nString(UIStrings.searchInterrupted);
483
485
  }
484
486
 
485
487
  override focus(): void {
486
- this.search.focus();
487
- this.search.select();
488
+ this.#searchInputElement.focus();
489
+ this.#searchInputElement.select();
488
490
  }
489
491
 
490
492
  override willHide(): void {
491
- this.stopSearch();
493
+ this.#stopSearch();
492
494
  }
493
495
 
494
- private onKeyDown(event: KeyboardEvent): void {
495
- this.save();
496
+ #onQueryKeyDown(event: KeyboardEvent): void {
497
+ this.#save();
496
498
  switch (event.keyCode) {
497
499
  case UI.KeyboardShortcut.Keys.Enter.code:
498
- this.onAction();
500
+ this.#onRefresh();
499
501
  break;
500
502
  }
501
503
  }
@@ -518,7 +520,7 @@ export class SearchView extends UI.Widget.VBox {
518
520
  *
519
521
  * @param event KeyboardEvent
520
522
  */
521
- private onKeyDownOnPanel(event: KeyboardEvent): void {
523
+ #onPanelKeyDown(event: KeyboardEvent): void {
522
524
  const isMac = Host.Platform.isMac();
523
525
  // "Command + Alt + ]" for Mac
524
526
  const shouldShowAllForMac =
@@ -534,49 +536,61 @@ export class SearchView extends UI.Widget.VBox {
534
536
  !isMac && event.ctrlKey && !event.metaKey && event.shiftKey && event.code === 'BracketLeft';
535
537
 
536
538
  if (shouldShowAllForMac || shouldShowAllForOtherPlatforms) {
537
- this.searchResultsPane?.showAllMatches();
539
+ this.#searchResultsPane?.showAllMatches();
538
540
  void VisualLogging.logKeyDown(event.currentTarget, event, 'show-all-matches');
539
541
  } else if (shouldCollapseAllForMac || shouldCollapseAllForOtherPlatforms) {
540
- this.searchResultsPane?.collapseAllResults();
542
+ this.#searchResultsPane?.collapseAllResults();
541
543
  void VisualLogging.logKeyDown(event.currentTarget, event, 'collapse-all-results');
542
544
  }
543
545
  }
544
546
 
545
- private save(): void {
546
- this.advancedSearchConfig.set(this.buildSearchConfig().toPlainObject());
547
+ #save(): void {
548
+ this.#advancedSearchConfig.set(this.#buildSearchConfig().toPlainObject());
547
549
  }
548
550
 
549
- private load(): void {
550
- const searchConfig = Workspace.SearchConfig.SearchConfig.fromPlainObject(this.advancedSearchConfig.get());
551
- this.search.value = searchConfig.query();
551
+ #load(): void {
552
+ const searchConfig = Workspace.SearchConfig.SearchConfig.fromPlainObject(this.#advancedSearchConfig.get());
553
+ this.#searchInputElement.value = searchConfig.query();
552
554
 
553
- this.matchCaseButton.toggled = !searchConfig.ignoreCase();
554
- this.matchCaseButtonToggled();
555
+ this.#matchCaseButton.toggled = !searchConfig.ignoreCase();
556
+ this.#onToggleMatchCase();
555
557
 
556
- this.regexButton.toggled = searchConfig.isRegex();
557
- this.regexButtonToggled();
558
+ this.#regexButton.toggled = searchConfig.isRegex();
559
+ this.#onToggleRegex();
558
560
  }
559
561
 
560
- private onAction(): void {
561
- const searchConfig = this.buildSearchConfig();
562
+ #onRefresh(): void {
563
+ const searchConfig = this.#buildSearchConfig();
562
564
  if (!searchConfig.query()?.length) {
563
565
  return;
564
566
  }
565
- this.resetSearch();
566
- ++this.searchId;
567
- this.initScope();
568
- if (!this.isIndexing) {
569
- this.startIndexing();
567
+ this.#resetSearch();
568
+ ++this.#searchId;
569
+ this.#initScope();
570
+ if (!this.#isIndexing) {
571
+ this.#startIndexing();
570
572
  }
571
- this.pendingSearchConfig = searchConfig;
573
+ this.#pendingSearchConfig = searchConfig;
572
574
  }
573
575
 
574
- private onClearSearch(): void {
575
- this.resetSearch();
576
- this.onSearchInputClear();
576
+ #onClearSearch(): void {
577
+ this.#resetSearch();
578
+ this.#onClearSearchInput();
577
579
  }
578
580
 
579
581
  get throttlerForTest(): Common.Throttler.Throttler {
580
582
  return this.#throttler;
581
583
  }
584
+
585
+ get search(): HTMLInputElement {
586
+ return this.#searchInputElement;
587
+ }
588
+
589
+ get matchCaseButton(): Buttons.Button.Button {
590
+ return this.#matchCaseButton;
591
+ }
592
+
593
+ get regexButton(): Buttons.Button.Button {
594
+ return this.#regexButton;
595
+ }
582
596
  }
@@ -591,7 +591,7 @@ export class ShortcutListItem {
591
591
  const activeElement = Platform.DOMUtilities.deepActiveElement(document);
592
592
  for (const [shortcut, shortcutInput] of this.shortcutInputs.entries()) {
593
593
  if (activeElement === shortcutInput) {
594
- this.onShortcutInputKeyDown(shortcut, shortcutInput as HTMLInputElement, event as KeyboardEvent);
594
+ this.onShortcutInputKeyDown(shortcut, shortcutInput as HTMLInputElement, event);
595
595
  }
596
596
  }
597
597
  }