chrome-devtools-frontend 1.0.1555174 → 1.0.1555430

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 (66) hide show
  1. package/front_end/core/protocol_client/InspectorBackend.ts +1 -1
  2. package/front_end/core/root/Runtime.ts +0 -4
  3. package/front_end/core/sdk/DOMModel.ts +101 -7
  4. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +1 -1
  5. package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
  6. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -1
  7. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -1
  8. package/front_end/{ui/components → models}/annotations/AnnotationRepository.ts +3 -3
  9. package/front_end/models/annotations/README.md +7 -0
  10. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +8 -0
  11. package/front_end/models/stack_trace/StackTrace.ts +13 -2
  12. package/front_end/models/stack_trace/StackTraceImpl.ts +81 -6
  13. package/front_end/models/stack_trace/StackTraceModel.ts +35 -3
  14. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +45 -4
  15. package/front_end/panels/ai_assistance/components/ArtifactsViewer.ts +57 -0
  16. package/front_end/panels/ai_assistance/components/ChatView.ts +1 -0
  17. package/front_end/panels/ai_assistance/components/artifactsViewer.css +10 -0
  18. package/front_end/panels/application/preloading/PreloadingView.ts +12 -6
  19. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +230 -237
  20. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +96 -79
  21. package/front_end/panels/application/preloading/components/preloadingGrid.css +26 -29
  22. package/front_end/panels/application/preloading/preloadingView.css +6 -0
  23. package/front_end/panels/common/Annotation.ts +1 -1
  24. package/front_end/panels/common/AnnotationManager.ts +1 -1
  25. package/front_end/panels/common/ExtensionView.ts +1 -0
  26. package/front_end/panels/console/ConsoleContextSelector.ts +74 -9
  27. package/front_end/panels/console/consoleContextSelector.css +31 -29
  28. package/front_end/panels/coverage/coverageListView.css +59 -57
  29. package/front_end/panels/elements/ElementsPanel.ts +1 -1
  30. package/front_end/panels/elements/ElementsTreeElement.ts +39 -1
  31. package/front_end/panels/elements/ElementsTreeOutline.ts +23 -21
  32. package/front_end/panels/elements/TopLayerContainer.ts +26 -91
  33. package/front_end/panels/explain/components/ConsoleInsight.ts +3 -3
  34. package/front_end/panels/network/NetworkItemView.ts +1 -1
  35. package/front_end/panels/network/NetworkLogView.ts +1 -1
  36. package/front_end/panels/network/NetworkPanel.ts +1 -1
  37. package/front_end/panels/recorder/RecorderController.ts +0 -1
  38. package/front_end/panels/security/SecurityPanelSidebar.ts +5 -0
  39. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -8
  40. package/front_end/panels/timeline/components/TimelineSummary.ts +75 -54
  41. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +16 -25
  42. package/front_end/panels/timeline/components/insights/Cache.ts +12 -8
  43. package/front_end/panels/timeline/components/insights/DOMSize.ts +25 -21
  44. package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +7 -7
  45. package/front_end/panels/timeline/components/insights/FontDisplay.ts +7 -5
  46. package/front_end/panels/timeline/components/insights/ForcedReflow.ts +11 -9
  47. package/front_end/panels/timeline/components/insights/INPBreakdown.ts +7 -6
  48. package/front_end/panels/timeline/components/insights/ImageDelivery.ts +7 -5
  49. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +20 -18
  50. package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +12 -12
  51. package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +7 -7
  52. package/front_end/panels/timeline/components/insights/ModernHTTP.ts +7 -5
  53. package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +15 -13
  54. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +2 -2
  55. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +15 -14
  56. package/front_end/panels/timeline/components/insights/Table.ts +152 -130
  57. package/front_end/panels/timeline/components/insights/ThirdParties.ts +11 -9
  58. package/front_end/panels/timeline/components/timelineSummary.css +58 -57
  59. package/front_end/panels/timeline/thirdPartyTreeView.css +109 -0
  60. package/front_end/panels/timeline/timelineDetailsView.css +2 -4
  61. package/front_end/panels/timeline/timelinePanel.css +0 -110
  62. package/front_end/ui/legacy/TabbedPane.ts +1 -1
  63. package/front_end/ui/legacy/ViewManager.ts +2 -32
  64. package/package.json +1 -1
  65. /package/front_end/{ui/components → models}/annotations/AnnotationType.ts +0 -0
  66. /package/front_end/{ui/components → models}/annotations/annotations.ts +0 -0
@@ -1,7 +1,6 @@
1
1
  // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-imperative-dom-api */
5
4
 
6
5
  import '../../../../ui/components/markdown_view/markdown_view.js';
7
6
 
@@ -70,7 +69,7 @@ interface ViewInput {
70
69
  model: InsightModel;
71
70
  selected: boolean;
72
71
  isAIAssistanceContext: boolean;
73
- canShowAskAI: boolean;
72
+ showAskAI: boolean;
74
73
  estimatedSavingsString: string|null;
75
74
  estimatedSavingsAriaLabel: string|null;
76
75
  renderContent: () => Lit.LitTemplate;
@@ -89,7 +88,7 @@ const DEFAULT_VIEW: View = (input, output, target) => {
89
88
  estimatedSavingsString,
90
89
  estimatedSavingsAriaLabel,
91
90
  isAIAssistanceContext,
92
- canShowAskAI,
91
+ showAskAI,
93
92
  dispatchInsightToggle,
94
93
  renderContent,
95
94
  onHeaderKeyDown,
@@ -122,7 +121,7 @@ const DEFAULT_VIEW: View = (input, output, target) => {
122
121
  <div class="insight-body">
123
122
  <div class="insight-description">${md(model.description)}</div>
124
123
  <div class="insight-content">${content}</div>
125
- ${canShowAskAI ? html`
124
+ ${showAskAI ? html`
126
125
  <div class="ask-ai-btn-wrap">
127
126
  <devtools-button class="ask-ai"
128
127
  .variant=${Buttons.Button.Variant.OUTLINED}
@@ -206,9 +205,6 @@ export abstract class BaseInsightComponent<T extends InsightModel> extends UI.Wi
206
205
  #view: View;
207
206
  abstract internalName: string;
208
207
 
209
- // This flag tracks if the Insights AI feature is enabled within Chrome for
210
- // the active user.
211
- #askAiEnabled = false;
212
208
  // Tracks if this component is rendered withing the AI assistance panel.
213
209
  // Currently only relevant to GreenDev.
214
210
  #isAIAssistanceContext = false;
@@ -246,16 +242,6 @@ export abstract class BaseInsightComponent<T extends InsightModel> extends UI.Wi
246
242
  return false;
247
243
  }
248
244
 
249
- override wasShown(): void {
250
- super.wasShown();
251
-
252
- // Used for unit test purposes when querying the DOM.
253
- this.element.dataset.insightName = this.internalName;
254
-
255
- const {devToolsAiAssistancePerformanceAgent} = Root.Runtime.hostConfig;
256
- this.#askAiEnabled = Boolean(devToolsAiAssistancePerformanceAgent?.enabled);
257
- }
258
-
259
245
  set isAIAssistanceContext(isAIAssistanceContext: boolean) {
260
246
  this.#isAIAssistanceContext = isAIAssistanceContext;
261
247
  this.requestUpdate();
@@ -300,11 +286,11 @@ export abstract class BaseInsightComponent<T extends InsightModel> extends UI.Wi
300
286
  this.requestUpdate();
301
287
  }
302
288
 
303
- set agentFocus(agentFocus: AIAssistance.AIContext.AgentFocus) {
289
+ set agentFocus(agentFocus: AIAssistance.AIContext.AgentFocus|null) {
304
290
  this.#agentFocus = agentFocus;
305
291
  }
306
292
 
307
- set fieldMetrics(fieldMetrics: Trace.Insights.Common.CrUXFieldMetricResults) {
293
+ set fieldMetrics(fieldMetrics: Trace.Insights.Common.CrUXFieldMetricResults|null) {
308
294
  this.#fieldMetrics = fieldMetrics;
309
295
  }
310
296
 
@@ -422,7 +408,7 @@ export abstract class BaseInsightComponent<T extends InsightModel> extends UI.Wi
422
408
  estimatedSavingsString: this.getEstimatedSavingsString(),
423
409
  estimatedSavingsAriaLabel: this.#getEstimatedSavingsAriaLabel(),
424
410
  isAIAssistanceContext: this.#isAIAssistanceContext,
425
- canShowAskAI: this.#canShowAskAI(),
411
+ showAskAI: this.#canShowAskAI(),
426
412
  dispatchInsightToggle: () => this.#dispatchInsightToggle(),
427
413
  renderContent: () => this.renderContent(),
428
414
  onHeaderKeyDown: () => this.#onHeaderKeyDown,
@@ -527,14 +513,19 @@ export abstract class BaseInsightComponent<T extends InsightModel> extends UI.Wi
527
513
  }
528
514
 
529
515
  #canShowAskAI(): boolean {
530
- if (this.#isAIAssistanceContext) {
516
+ if (this.#isAIAssistanceContext || !this.hasAskAiSupport()) {
531
517
  return false;
532
518
  }
533
519
 
534
- const aiAvailable = Root.Runtime.hostConfig.aidaAvailability?.enterprisePolicyValue !==
535
- Root.Runtime.GenAiEnterprisePolicyValue.DISABLE &&
536
- this.#askAiEnabled && Root.Runtime.hostConfig.aidaAvailability?.enabled === true;
520
+ // Check if the Insights AI feature enabled within Chrome for the active user.
521
+ const {devToolsAiAssistancePerformanceAgent} = Root.Runtime.hostConfig;
522
+ const askAiEnabled = Boolean(devToolsAiAssistancePerformanceAgent?.enabled);
523
+ if (!askAiEnabled) {
524
+ return false;
525
+ }
537
526
 
538
- return aiAvailable && this.hasAskAiSupport();
527
+ const {aidaAvailability} = Root.Runtime.hostConfig;
528
+ return aidaAvailability?.enterprisePolicyValue !== Root.Runtime.GenAiEnterprisePolicyValue.DISABLE &&
529
+ aidaAvailability?.enabled === true;
539
530
  }
540
531
  }
@@ -7,15 +7,17 @@ import './Table.js';
7
7
  import * as i18n from '../../../../core/i18n/i18n.js';
8
8
  import type {CacheInsightModel} from '../../../../models/trace/insights/Cache.js';
9
9
  import * as Trace from '../../../../models/trace/trace.js';
10
+ import * as UI from '../../../../ui/legacy/legacy.js';
10
11
  import * as Lit from '../../../../ui/lit/lit.js';
11
12
 
12
13
  import {BaseInsightComponent} from './BaseInsightComponent.js';
13
14
  import {eventRef} from './EventRef.js';
14
- import {createLimitedRows, renderOthersLabel, type TableData, type TableDataRow} from './Table.js';
15
+ import {createLimitedRows, renderOthersLabel, Table, type TableDataRow} from './Table.js';
15
16
 
16
17
  const {UIStrings, i18nString, createOverlayForRequest} = Trace.Insights.Models.Cache;
17
18
 
18
19
  const {html} = Lit;
20
+ const {widgetConfig} = UI.Widget;
19
21
 
20
22
  export class Cache extends BaseInsightComponent<CacheInsightModel> {
21
23
  override internalName = 'cache';
@@ -56,13 +58,15 @@ export class Cache extends BaseInsightComponent<CacheInsightModel> {
56
58
  // clang-format off
57
59
  return html`
58
60
  <div class="insight-section">
59
- <devtools-performance-table
60
- .data=${{
61
- insight: this,
62
- headers: [i18nString(UIStrings.requestColumn), i18nString(UIStrings.cacheTTL)],
63
- rows,
64
- } as TableData}>
65
- </devtools-performance-table>
61
+ <devtools-widget
62
+ .widgetConfig=${widgetConfig(Table, {
63
+ data: {
64
+ insight: this,
65
+ headers: [i18nString(UIStrings.requestColumn), i18nString(UIStrings.cacheTTL)],
66
+ rows,
67
+ },
68
+ })}>
69
+ </devtools-widget>
66
70
  </div>`;
67
71
  // clang-format on
68
72
  }
@@ -8,17 +8,19 @@ import './Table.js';
8
8
  import * as i18n from '../../../../core/i18n/i18n.js';
9
9
  import type {DOMSizeInsightModel} from '../../../../models/trace/insights/DOMSize.js';
10
10
  import * as Trace from '../../../../models/trace/trace.js';
11
+ import * as UI from '../../../../ui/legacy/legacy.js';
11
12
  import * as Lit from '../../../../ui/lit/lit.js';
12
13
 
13
14
  import {BaseInsightComponent} from './BaseInsightComponent.js';
14
15
  import {eventRef} from './EventRef.js';
15
16
  import {md} from './Helpers.js';
16
17
  import {nodeLink} from './NodeLink.js';
17
- import type {TableData, TableDataRow} from './Table.js';
18
+ import {Table, type TableDataRow} from './Table.js';
18
19
 
19
20
  const {UIStrings, i18nString} = Trace.Insights.Models.DOMSize;
20
21
 
21
22
  const {html} = Lit;
23
+ const {widgetConfig} = UI.Widget;
22
24
 
23
25
  export class DOMSize extends BaseInsightComponent<DOMSizeInsightModel> {
24
26
  override internalName = 'dom-size';
@@ -28,7 +30,7 @@ export class DOMSize extends BaseInsightComponent<DOMSizeInsightModel> {
28
30
  }
29
31
 
30
32
  #renderNodeTable(domStatsData: Trace.Types.Events.DOMStats['args']['data']): Lit.LitTemplate {
31
- const rows: TableData['rows'] = [];
33
+ const rows: TableDataRow[] = [];
32
34
 
33
35
  if (domStatsData.maxDepth) {
34
36
  const {nodeId, nodeName} = domStatsData.maxDepth;
@@ -56,13 +58,13 @@ export class DOMSize extends BaseInsightComponent<DOMSizeInsightModel> {
56
58
 
57
59
  // clang-format off
58
60
  return html`<div class="insight-section">
59
- <devtools-performance-table
60
- .data=${{
61
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
62
+ data: {
61
63
  insight: this,
62
64
  headers: [i18nString(UIStrings.statistic), i18nString(UIStrings.element)],
63
65
  rows,
64
- } as TableData}>
65
- </devtools-performance-table>
66
+ }})}>
67
+ </devtools-widget>
66
68
  </div>`;
67
69
  // clang-format on
68
70
  }
@@ -86,13 +88,13 @@ export class DOMSize extends BaseInsightComponent<DOMSizeInsightModel> {
86
88
  // clang-format off
87
89
  return html`<div class="insight-section">
88
90
  <div class="insight-description">${md(i18nString(UIStrings.topUpdatesDescription))}</div>
89
- <devtools-performance-table
90
- .data=${{
91
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
92
+ data: {
91
93
  insight: this,
92
94
  headers: ['', i18nString(UIStrings.duration)],
93
95
  rows,
94
- } as TableData}>
95
- </devtools-performance-table>
96
+ }})}>
97
+ </devtools-widget>
96
98
  </div>`;
97
99
  // clang-format on
98
100
  }
@@ -109,17 +111,19 @@ export class DOMSize extends BaseInsightComponent<DOMSizeInsightModel> {
109
111
 
110
112
  // clang-format off
111
113
  return html`<div class="insight-section">
112
- <devtools-performance-table
113
- .data=${{
114
- insight: this,
115
- headers: [i18nString(UIStrings.statistic), i18nString(UIStrings.value)],
116
- rows: [
117
- {values: [i18nString(UIStrings.totalElements), domStatsData.totalElements]},
118
- {values: [i18nString(UIStrings.maxDOMDepth), domStatsData.maxDepth?.depth ?? 0]},
119
- {values: [i18nString(UIStrings.maxChildren), domStatsData.maxChildren?.numChildren ?? 0]},
120
- ],
121
- } as TableData}>
122
- </devtools-performance-table>
114
+ <devtools-widget
115
+ .widgetConfig=${widgetConfig(Table, {
116
+ data: {
117
+ insight: this,
118
+ headers: [i18nString(UIStrings.statistic), i18nString(UIStrings.value)],
119
+ rows: [
120
+ {values: [i18nString(UIStrings.totalElements), domStatsData.totalElements]},
121
+ {values: [i18nString(UIStrings.maxDOMDepth), domStatsData.maxDepth?.depth ?? 0]},
122
+ {values: [i18nString(UIStrings.maxChildren), domStatsData.maxChildren?.numChildren ?? 0]},
123
+ ],
124
+ },
125
+ })}>
126
+ </devtools-widget>
123
127
  </div>
124
128
  ${this.#renderNodeTable(domStatsData)}
125
129
  ${this.#renderLargeUpdatesTable()}
@@ -2,23 +2,23 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import './Table.js';
6
-
7
5
  import * as i18n from '../../../../core/i18n/i18n.js';
8
6
  import type {DuplicatedJavaScriptInsightModel} from '../../../../models/trace/insights/DuplicatedJavaScript.js';
9
7
  import * as Trace from '../../../../models/trace/trace.js';
10
8
  import * as Buttons from '../../../../ui/components/buttons/buttons.js';
9
+ import * as UI from '../../../../ui/legacy/legacy.js';
11
10
  import * as Lit from '../../../../ui/lit/lit.js';
12
11
  import * as VisualLogging from '../../../../ui/visual_logging/visual_logging.js';
13
12
  import * as Utils from '../../utils/utils.js';
14
13
 
15
14
  import {BaseInsightComponent} from './BaseInsightComponent.js';
16
15
  import {scriptRef} from './ScriptRef.js';
17
- import type {TableData, TableDataRow} from './Table.js';
16
+ import {Table, type TableDataRow} from './Table.js';
18
17
 
19
18
  const {UIStrings, i18nString} = Trace.Insights.Models.DuplicatedJavaScript;
20
19
 
21
20
  const {html} = Lit;
21
+ const {widgetConfig} = UI.Widget;
22
22
 
23
23
  export class DuplicatedJavaScript extends BaseInsightComponent<DuplicatedJavaScriptInsightModel> {
24
24
  override internalName = 'duplicated-javascript';
@@ -105,13 +105,13 @@ export class DuplicatedJavaScript extends BaseInsightComponent<DuplicatedJavaScr
105
105
  return html`
106
106
  ${treemapButton}
107
107
  <div class="insight-section">
108
- <devtools-performance-table
109
- .data=${{
108
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
109
+ data: {
110
110
  insight: this,
111
111
  headers: [i18nString(UIStrings.columnSource), i18nString(UIStrings.columnDuplicatedBytes)],
112
112
  rows,
113
- } as TableData}>
114
- </devtools-performance-table>
113
+ }})}>
114
+ </devtools-widget>
115
115
  </div>
116
116
  `;
117
117
  // clang-format on
@@ -7,15 +7,17 @@ import './Table.js';
7
7
  import * as i18n from '../../../../core/i18n/i18n.js';
8
8
  import type {FontDisplayInsightModel} from '../../../../models/trace/insights/FontDisplay.js';
9
9
  import * as Trace from '../../../../models/trace/trace.js';
10
+ import * as UI from '../../../../ui/legacy/legacy.js';
10
11
  import * as Lit from '../../../../ui/lit/lit.js';
11
12
 
12
13
  import {BaseInsightComponent} from './BaseInsightComponent.js';
13
14
  import {eventRef} from './EventRef.js';
14
- import {createLimitedRows, renderOthersLabel, type TableData, type TableDataRow} from './Table.js';
15
+ import {createLimitedRows, renderOthersLabel, Table, type TableDataRow} from './Table.js';
15
16
 
16
17
  const {UIStrings, i18nString} = Trace.Insights.Models.FontDisplay;
17
18
 
18
19
  const {html} = Lit;
20
+ const {widgetConfig} = UI.Widget;
19
21
 
20
22
  export class FontDisplay extends BaseInsightComponent<FontDisplayInsightModel> {
21
23
  override internalName = 'font-display';
@@ -76,13 +78,13 @@ export class FontDisplay extends BaseInsightComponent<FontDisplayInsightModel> {
76
78
  // clang-format off
77
79
  return html`
78
80
  <div class="insight-section">
79
- ${html`<devtools-performance-table
80
- .data=${{
81
+ ${html`<devtools-widget .widgetConfig=${widgetConfig(Table, {
82
+ data: {
81
83
  insight: this,
82
84
  headers: [i18nString(UIStrings.fontColumn), i18nString(UIStrings.wastedTimeColumn)],
83
85
  rows,
84
- } as TableData}>
85
- </devtools-performance-table>`}
86
+ }})}>
87
+ </devtools-widget>`}
86
88
  </div>`;
87
89
  // clang-format on
88
90
  }
@@ -9,14 +9,16 @@ import type * as Protocol from '../../../../generated/protocol.js';
9
9
  import type {ForcedReflowInsightModel} from '../../../../models/trace/insights/ForcedReflow.js';
10
10
  import * as Trace from '../../../../models/trace/trace.js';
11
11
  import * as LegacyComponents from '../../../../ui/legacy/components/utils/utils.js';
12
+ import * as UI from '../../../../ui/legacy/legacy.js';
12
13
  import * as Lit from '../../../../ui/lit/lit.js';
13
14
 
14
15
  import {BaseInsightComponent} from './BaseInsightComponent.js';
15
- import {createLimitedRows, renderOthersLabel, type TableData, type TableDataRow} from './Table.js';
16
+ import {createLimitedRows, renderOthersLabel, Table, type TableDataRow} from './Table.js';
16
17
 
17
18
  const {UIStrings, i18nString, createOverlayForEvents} = Trace.Insights.Models.ForcedReflow;
18
19
 
19
20
  const {html, nothing} = Lit;
21
+ const {widgetConfig} = UI.Widget;
20
22
 
21
23
  export class ForcedReflow extends BaseInsightComponent<ForcedReflowInsightModel> {
22
24
  override internalName = 'forced-reflow';
@@ -85,8 +87,8 @@ export class ForcedReflow extends BaseInsightComponent<ForcedReflowInsightModel>
85
87
  return html`
86
88
  ${topLevelFunctionCallData ? html`
87
89
  <div class="insight-section">
88
- <devtools-performance-table
89
- .data=${{
90
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
91
+ data: {
90
92
  insight: this,
91
93
  headers: [i18nString(UIStrings.topTimeConsumingFunctionCall), i18nString(UIStrings.totalReflowTime)],
92
94
  rows: [{
@@ -96,18 +98,18 @@ export class ForcedReflow extends BaseInsightComponent<ForcedReflowInsightModel>
96
98
  ],
97
99
  overlays: createOverlayForEvents(topLevelFunctionCallData.topLevelFunctionCallEvents, 'INFO'),
98
100
  }],
99
- } as TableData}>
100
- </devtools-performance-table>
101
+ }})}>
102
+ </devtools-widget>
101
103
  </div>
102
104
  ` : nothing}
103
105
  <div class="insight-section">
104
- <devtools-performance-table
105
- .data=${{
106
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
107
+ data: {
106
108
  insight: this,
107
109
  headers: [i18nString(UIStrings.reflowCallFrames)],
108
110
  rows,
109
- } as TableData}>
110
- </devtools-performance-table>
111
+ }})}>
112
+ </devtools-widget>
111
113
  </div>`;
112
114
  // clang-format on
113
115
  }
@@ -2,19 +2,20 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import './Table.js';
6
-
7
5
  import * as i18n from '../../../../core/i18n/i18n.js';
8
6
  import * as Platform from '../../../../core/platform/platform.js';
9
7
  import type {INPBreakdownInsightModel} from '../../../../models/trace/insights/INPBreakdown.js';
10
8
  import * as Trace from '../../../../models/trace/trace.js';
9
+ import * as UI from '../../../../ui/legacy/legacy.js';
11
10
  import * as Lit from '../../../../ui/lit/lit.js';
12
11
 
13
12
  import {BaseInsightComponent} from './BaseInsightComponent.js';
13
+ import {Table} from './Table.js';
14
14
 
15
15
  const {UIStrings, i18nString, createOverlaysForSubpart} = Trace.Insights.Models.INPBreakdown;
16
16
 
17
17
  const {html} = Lit;
18
+ const {widgetConfig} = UI.Widget;
18
19
 
19
20
  export class INPBreakdown extends BaseInsightComponent<INPBreakdownInsightModel> {
20
21
  override internalName = 'inp';
@@ -35,8 +36,8 @@ export class INPBreakdown extends BaseInsightComponent<INPBreakdownInsightModel>
35
36
  // clang-format off
36
37
  return html`
37
38
  <div class="insight-section">
38
- ${html`<devtools-performance-table
39
- .data=${{
39
+ ${html`<devtools-widget .widgetConfig=${widgetConfig(Table, {
40
+ data: {
40
41
  insight: this,
41
42
  headers: [i18nString(UIStrings.subpart), i18nString(UIStrings.duration)],
42
43
  rows: [
@@ -53,8 +54,8 @@ export class INPBreakdown extends BaseInsightComponent<INPBreakdownInsightModel>
53
54
  overlays: createOverlaysForSubpart(event, 2),
54
55
  },
55
56
  ],
56
- }}>
57
- </devtools-performance-table>`}
57
+ }})}>
58
+ </devtools-widget>`}
58
59
  </div>`;
59
60
  // clang-format on
60
61
  }
@@ -6,15 +6,17 @@ import '../../../../ui/kit/kit.js';
6
6
 
7
7
  import type {ImageDeliveryInsightModel} from '../../../../models/trace/insights/ImageDelivery.js';
8
8
  import * as Trace from '../../../../models/trace/trace.js';
9
+ import * as UI from '../../../../ui/legacy/legacy.js';
9
10
  import * as Lit from '../../../../ui/lit/lit.js';
10
11
 
11
12
  import {BaseInsightComponent} from './BaseInsightComponent.js';
12
13
  import {imageRef} from './ImageRef.js';
13
- import {createLimitedRows, renderOthersLabel, type TableDataRow} from './Table.js';
14
+ import {createLimitedRows, renderOthersLabel, Table, type TableDataRow} from './Table.js';
14
15
 
15
16
  const {UIStrings, i18nString, createOverlayForRequest} = Trace.Insights.Models.ImageDelivery;
16
17
 
17
18
  const {html} = Lit;
19
+ const {widgetConfig} = UI.Widget;
18
20
 
19
21
  export class ImageDelivery extends BaseInsightComponent<ImageDeliveryInsightModel> {
20
22
  override internalName = 'image-delivery';
@@ -56,13 +58,13 @@ export class ImageDelivery extends BaseInsightComponent<ImageDeliveryInsightMode
56
58
  // clang-format off
57
59
  return html`
58
60
  <div class="insight-section">
59
- <devtools-performance-table
60
- .data=${{
61
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
62
+ data: {
61
63
  insight: this,
62
64
  headers: [i18nString(UIStrings.optimizeFile)],
63
65
  rows,
64
- }}>
65
- </devtools-performance-table>
66
+ }})}>
67
+ </devtools-widget>
66
68
  </div>
67
69
  `;
68
70
  // clang-format on
@@ -61,30 +61,32 @@ export class InsightRenderer {
61
61
  renderInsightToWidgetElement(
62
62
  parsedTrace: Trace.TraceModel.ParsedTrace, insightSet: Trace.Insights.Types.InsightSet,
63
63
  model: Trace.Insights.Types.InsightModel, insightName: string,
64
- options: Partial<BaseInsightComponent<Trace.Insights.Types.InsightModel>>): InsightWidgetElement {
64
+ options: Partial<Pick<
65
+ BaseInsightComponent<Trace.Insights.Types.InsightModel>,
66
+ 'selected'|'agentFocus'|'fieldMetrics'|'isAIAssistanceContext'>>): InsightWidgetElement {
65
67
  let widgetElement = this.#insightWidgetCache.get(model);
66
68
  if (!widgetElement) {
67
69
  widgetElement = document.createElement('devtools-widget') as InsightWidgetElement;
68
-
69
- const componentClass = INSIGHT_NAME_TO_COMPONENT[insightName as keyof typeof INSIGHT_NAME_TO_COMPONENT];
70
- const widget = new componentClass(widgetElement) as BaseInsightComponent<Trace.Insights.Types.InsightModel>;
71
- widget.selected = false;
72
- widget.parsedTrace = parsedTrace;
73
- widget.model = model;
74
- widget.bounds = insightSet.bounds;
75
- widget.insightSetKey = insightSet.id;
76
- Object.assign(widget, options);
77
- widgetElement.widgetConfig = widgetConfig(() => {
78
- return widget;
79
- });
80
-
70
+ widgetElement.classList.add('insight-component-widget');
81
71
  this.#insightWidgetCache.set(model, widgetElement);
82
72
  }
83
73
 
84
- const widget = widgetElement.getWidget();
85
- if (widget) {
86
- Object.assign(widget, options);
87
- }
74
+ const componentClass = INSIGHT_NAME_TO_COMPONENT[insightName as keyof typeof INSIGHT_NAME_TO_COMPONENT];
75
+ widgetElement.widgetConfig = widgetConfig(componentClass, {
76
+ selected: options.selected ?? false,
77
+ parsedTrace,
78
+ // The `model` passed in as a parameter is the base type, but since
79
+ // `componentClass` is the union of every derived insight component, the
80
+ // `model` for the widget config is the union of every model. That can't be
81
+ // satisfied, so disable typescript.
82
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
+ model: model as any,
84
+ bounds: insightSet.bounds,
85
+ insightSetKey: insightSet.id,
86
+ agentFocus: options.agentFocus ?? null,
87
+ fieldMetrics: options.fieldMetrics ?? null,
88
+ isAIAssistanceContext: options.isAIAssistanceContext ?? false,
89
+ });
88
90
 
89
91
  return widgetElement;
90
92
  }
@@ -2,20 +2,20 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import './Table.js';
6
-
7
5
  import * as i18n from '../../../../core/i18n/i18n.js';
8
6
  import type {LCPBreakdownInsightModel} from '../../../../models/trace/insights/LCPBreakdown.js';
9
7
  import * as Trace from '../../../../models/trace/trace.js';
8
+ import * as UI from '../../../../ui/legacy/legacy.js';
10
9
  import * as Lit from '../../../../ui/lit/lit.js';
11
10
  import type * as Overlays from '../../overlays/overlays.js';
12
11
 
13
12
  import {BaseInsightComponent} from './BaseInsightComponent.js';
14
- import type {TableData} from './Table.js';
13
+ import {Table, type TableDataRow} from './Table.js';
15
14
 
16
15
  const {UIStrings, i18nString} = Trace.Insights.Models.LCPBreakdown;
17
16
 
18
17
  const {html} = Lit;
18
+ const {widgetConfig} = UI.Widget;
19
19
 
20
20
  export class LCPBreakdown extends BaseInsightComponent<LCPBreakdownInsightModel> {
21
21
  override internalName = 'lcp-by-phase';
@@ -69,13 +69,13 @@ export class LCPBreakdown extends BaseInsightComponent<LCPBreakdownInsightModel>
69
69
  // clang-format off
70
70
  return html`
71
71
  <div class="insight-section">
72
- <devtools-performance-table
73
- .data=${{
72
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
73
+ data: {
74
74
  insight: this,
75
75
  headers: [i18nString(UIStrings.subpart), i18nString(UIStrings.fieldDuration)],
76
76
  rows,
77
- } as TableData}>
78
- </devtools-performance-table>
77
+ }})}>
78
+ </devtools-widget>
79
79
  </div>
80
80
  `;
81
81
  // clang-format on
@@ -101,7 +101,7 @@ export class LCPBreakdown extends BaseInsightComponent<LCPBreakdownInsightModel>
101
101
  return html`<div class="insight-section">${i18nString(UIStrings.noLcp)}</div>`;
102
102
  }
103
103
 
104
- const rows = Object.values(subparts).map((subpart: Trace.Insights.Models.LCPBreakdown.Subpart) => {
104
+ const rows: TableDataRow[] = Object.values(subparts).map((subpart: Trace.Insights.Models.LCPBreakdown.Subpart) => {
105
105
  const section = this.#overlay?.sections.find(section => subpart.label === section.label);
106
106
  const timing = Trace.Helpers.Timing.microToMilli(subpart.range);
107
107
  return {
@@ -116,13 +116,13 @@ export class LCPBreakdown extends BaseInsightComponent<LCPBreakdownInsightModel>
116
116
  // clang-format off
117
117
  const sections: Lit.LitTemplate[] = [html`
118
118
  <div class="insight-section">
119
- <devtools-performance-table
120
- .data=${{
119
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
120
+ data: {
121
121
  insight: this,
122
122
  headers: [i18nString(UIStrings.subpart), i18nString(UIStrings.duration)],
123
123
  rows,
124
- } as TableData}>
125
- </devtools-performance-table>
124
+ }})}>
125
+ </devtools-widget>
126
126
  </div>`
127
127
  ];
128
128
  // clang-format on
@@ -2,8 +2,6 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import './Table.js';
6
-
7
5
  import * as Common from '../../../../core/common/common.js';
8
6
  import * as i18n from '../../../../core/i18n/i18n.js';
9
7
  import * as SDK from '../../../../core/sdk/sdk.js';
@@ -11,15 +9,17 @@ import * as Bindings from '../../../../models/bindings/bindings.js';
11
9
  import type {
12
10
  LegacyJavaScriptInsightModel, PatternMatchResult} from '../../../../models/trace/insights/LegacyJavaScript.js';
13
11
  import * as Trace from '../../../../models/trace/trace.js';
12
+ import * as UI from '../../../../ui/legacy/legacy.js';
14
13
  import * as Lit from '../../../../ui/lit/lit.js';
15
14
 
16
15
  import {BaseInsightComponent} from './BaseInsightComponent.js';
17
16
  import {scriptRef} from './ScriptRef.js';
18
- import type {TableData, TableDataRow} from './Table.js';
17
+ import {Table, type TableDataRow} from './Table.js';
19
18
 
20
19
  const {UIStrings, i18nString} = Trace.Insights.Models.LegacyJavaScript;
21
20
 
22
21
  const {html} = Lit;
22
+ const {widgetConfig} = UI.Widget;
23
23
 
24
24
  export class LegacyJavaScript extends BaseInsightComponent<LegacyJavaScriptInsightModel> {
25
25
  override internalName = 'legacy-javascript';
@@ -85,13 +85,13 @@ export class LegacyJavaScript extends BaseInsightComponent<LegacyJavaScriptInsig
85
85
  // clang-format off
86
86
  return html`
87
87
  <div class="insight-section">
88
- <devtools-performance-table
89
- .data=${{
88
+ <devtools-widget .widgetConfig=${widgetConfig(Table, {
89
+ data: {
90
90
  insight: this,
91
91
  headers: [i18nString(UIStrings.columnScript), i18nString(UIStrings.columnWastedBytes)],
92
92
  rows,
93
- } as TableData}>
94
- </devtools-performance-table>
93
+ }})}>
94
+ </devtools-widget>
95
95
  </div>
96
96
  `;
97
97
  // clang-format on